RE: help! (DLLs)
- Posted by Matthew Lewis <matthewwalkerlewis at YAHOO.COM> May 11, 2001
- 450 views
> -----Original Message----- > From: sephiroth _ [mailto:euman2376 at yahoo.com] > i tried that, and no change. btw, i pedump'ed it and apparently it > doesn't add underscores, but all compilers prepend underscores to > function names I just made a little dll (dll.dll) with lcc by translating and running emake. No def file or anything, and it returned the name of the function with an underscore and @4 appended (1 arg): -- begin dll.ew global function huh( atom x ) return rand(5) end function -- end dll.ew Eu function: huh( atom x ) C function: _0huh( int x ) DLL function: __0huh@4 Now, I tried a DEF file (dll.def): EXPORTS huh = _0huh and rebuilt the dll. LCC still exported __0huh@4, but also exported huh. Removing the __declspec(dllexport) from the function definition (in dll.c) and the prototype in main_.h, and the only thing exported was huh. The same thing worked with Borland (I don't have Watcom). LCC seems to need to have the .def file included in the call to the linker, while Borland finds the .def file on its own. Rob, I think it would be better to not declare anything _declspec(dllexport), but to create a def file with the original Eu routine names in an export file. It would make things much cleaner, and shouldn't be too difficult. It would also make it easy to include/exclude routines from being exported (for instance, if win32lib is included in the source for the dll, it's probably not necessary to export all the routines in win32lib). Matt Lewis