From: HARBAUGH AT FCRFV1 DOT NCIFCRF DOT GOV Subject: RE: Making DLL4s 13 Apr 1997 09:18:34 -0700 Approved: cygnus DOT gnu-win32 AT cygnus DOT com Distribution: cygnus Message-ID: <970413094623.20411870.cygnus.gnu-win32@FCRFV1.NCIFCRF.GOV> Original-To: GNU-WIN32 AT cygnus DOT com Original-CC: HARBAUGH AT FCRFV1 DOT NCIFCRF DOT GOV Original-Sender: owner-gnu-win32 AT cygnus DOT com From: FCRFV1::HARBAUGH 13-APR-1997 09:44:54.80 To: SMTP%"ij AT usa DOT net" CC: HARBAUGH Subj: RE: Making DLL4s Ismael Jurado recently wrote: >Days ago I had a problem making DLL's that I don't knew how to solve. >I ask >the mailing list, saw the faq ... and well, now I KNOW how to build a >relocatable >DLL that can be linked whith an application or be loaded via >LoadLibrary()... >that is, a working DLL. >This has been tested with Windows 95 but is supposed to work with NT >as well. >If you don't want to have pain building your own DLL, follow my >instructions ... >and have luck! > > Ismael Jurado > ismaelj AT hotmail DOT com Ismael, your example worked great, but I still have a problem because I need to pass arguments. Whenever I try to write a function that passes arguments, the linker complains as follows: (d:\CYGNUS\H-I386~1\BIN\ld.exe 1304) In cygwin_except_handler (d:\CYGNUS\H-I386~1\BIN\ld.exe 1304) Exception trapped! (d:\CYGNUS\H-I386~1\BIN\ld.exe 1304) exception C0000005 at 438238 (d:\CYGNUS\H-I386~1\BIN\ld.exe 1304) exception: ax 45CA068 bx 0 cx 45F5D0C dx 28 (d:\CYGNUS\H-I386~1\BIN\ld.exe 1304) exception: si 4000 di 100113BF bp 258F054 sp 258F048 (d:\CYGNUS\H-I386~1\BIN\ld.exe 1304) exception is: STATUS_ACCESS_VIOLATION (d:\CYGNUS\H-I386~1\BIN\ld.exe 1304) Stack trace: (d:\CYGNUS\H-I386~1\BIN\ld.exe 1304) frame 0: sp = 0x258EE60, pc = 0x1001282A (d:\CYGNUS\H-I386~1\BIN\ld.exe 1304) frame 1: sp = 0x258EE7C, pc = 0xBFF76780 (d:\CYGNUS\H-I386~1\BIN\ld.exe 1304) frame 2: sp = 0x258EEA0, pc = 0xBFF858F3 (d:\CYGNUS\H-I386~1\BIN\ld.exe 1304) frame 3: sp = 0x258EF38, pc = 0xFFECBAD7 (d:\CYGNUS\H-I386~1\BIN\ld.exe 1304) frame 4: sp = 0x258F054, pc = 0x4383A9 (d:\CYGNUS\H-I386~1\BIN\ld.exe 1304) frame 5: sp = 0x258F0A4, pc = 0x43C476 (d:\CYGNUS\H-I386~1\BIN\ld.exe 1304) frame 6: sp = 0x258F4A4, pc = 0x424C2F (d:\CYGNUS\H-I386~1\BIN\ld.exe 1304) frame 7: sp = 0x258F504, pc = 0x418CBA (d:\CYGNUS\H-I386~1\BIN\ld.exe 1304) frame 8: sp = 0x258F548, pc = 0x10011BEB (d:\CYGNUS\H-I386~1\BIN\ld.exe 1304) frame 9: sp = 0x258FE14, pc = 0x10011BFF (d:\CYGNUS\H-I386~1\BIN\ld.exe 1304) frame 10: sp = 0x258FE20, pc = 0x453E50 (d:\CYGNUS\H-I386~1\BIN\ld.exe 1304) frame 11: sp = 0x258FE30, pc = 0x401012 (d:\CYGNUS\H-I386~1\BIN\ld.exe 1304) frame 12: sp = 0x258FE38, pc = 0xBFF88E93 (d:\CYGNUS\H-I386~1\BIN\ld.exe 1304) frame 13: sp = 0x258FF78, pc = 0xBFF88D41 (d:\CYGNUS\H-I386~1\BIN\ld.exe 1304) frame 14: sp = 0x258FFF4, pc = 0xBFF87759 (d:\CYGNUS\H-I386~1\BIN\ld.exe 1304) frame 15: sp = 0x815AC6BC, pc = 0x5 (d:\CYGNUS\H-I386~1\BIN\ld.exe 1304) End of stack trace (more stack frames may be present) I realize I must be doing something wrong, but I have no idea what it could be. Ultimately I want to be able to pass values back to a Visual Basic calling procedure. If you can help me, please let me know. Here is the dll source file I have been trying to use - 'mydll.c' /*------------------------- CUT --------------------------------*/ #include BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved) { return TRUE; } int doittoo () { return (10); } /* This is needed to terminate the list of inport stuff */ /* Copied from winsup/dcrt0.cc in the cygwin32 source distribution. */ asm(".section .idata$3\n" ".long 0,0,0,0,0,0,0,0"); /*------------------------- CUT --------------------------------*/ Here is the main program I have been trying to use to call doittoo(): /*------------------------- CUT --------------------------------*/ int main() { printf("doittoo(5) returns %d\n", doittoo(5)); } /*------------------------- CUT --------------------------------*/ ------------------------------------------------------------------------------ | Toni Harbaugh-Blackford | Internet: harbaugh AT ncifcrf DOT gov | | System Manager | | | Biomedical Supercomputing Center | Phone: (301) 846-5798 | | SAIC | FAX: (301) 846-5762 | | NCI-FCRDC | | | PO Box B, Bldg 430 | | | Frederick, MD 21702-1201 USA | | ------------------------------------------------------------------------------ - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".