1. help! (DLLs)
- Posted by sephiroth _ <euman2376 at yahoo.com> May 10, 2001
- 523 views
hey, i'm trying to make a DLL in LCC-Win32. it works when i write little C programs to link to it, but i can't use GetProcAddress(Win32 API) or define_c_proc(euphoria, of course ;) to get the address for my lone function test.c: #include <stdio.h> void sayit () { puts("Hello World!"); } test.def: EXPORTS sayit test.exw: include dll.e atom lib,func lib=open_dll("test.dll") func=define_c_proc(lib,"sayit",{}) -- func will now be -1 for some odd reason c_proc(func,{}) -- error and i compile my DLL like this: lc test.c -s -dll test.def any ideas what's going on here?
2. Re: help! (DLLs)
- Posted by stabmaster_ at HOTMAIL.COM May 11, 2001
- 471 views
Hmm.. does your C file have the following function in it? BOOL WINAPI __declspec(dllexport) LibMain(HINSTANCE hDLLInst, DWORD fdwReason, LPVOID lpvReserved) { switch (fdwReason) { case DLL_PROCESS_ATTACH: return TRUE; break; case DLL_PROCESS_DETACH: break; case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: break; } return TRUE; } Every dll must have a LibMain(). Oh, and now that I think about it; I recall lcc adding underscores to all function-names. So you prolly should try define_c_proc("test_").
3. Re: help! (DLLs)
- Posted by Euman <euman at bellsouth.net> May 11, 2001
- 469 views
I think all the info pertaining to @4 and _0func is in ec.html that comes with the translator.. declarations are made inside the calling program. Im confused Matt, what are you talking about. Euman ----- Original Message ----- From: "Matthew Lewis" <matthewwalkerlewis at YAHOO.COM> To: "EUforum" <EUforum at topica.com> Subject: RE: help! (DLLs) > > > > > -----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 > > > > > > > > > > <snip>
4. Re: help! (DLLs)
- Posted by Robert Craig <rds at RapidEuphoria.com> May 11, 2001
- 477 views
> Matt Lewis writes: > 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. OK, thanks, I'll look into that. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com