Re: Where is my DLL?
- Posted by "Wolf" <wolfritz at king.igs.net> Oct 15, 2005
- 635 views
> how can a DLL find the path where it was loaded from? > Somewhere on the internet I read: > | If you want to find the path for a DLL, pass the DLLs instance handle, > | which you can obtain from the first parameter in your DLL's DLLMain() > | function. > > Of course in Euphoria there is no DLLMain() function. When you create your DLL using "DLL_PROCESS_ATTACH", etc, this is! your DLLMain() function, though some call it LibMain(), or whatever... ...and the function's first parameter can be used to call GetModuleFileName(), I'd guess. This might be another round-about way... as an example. include dll.e include machine.e include misc.e constant k32=open_dll("kernel32.dll") ,GetModuleFileName=define_c_func(k32,"GetModuleFileNameA",{C_UINT,C_POINTER, C_INT},C_UINT) atom path, ret sequence name path=allocate(256+266) ret=c_func(GetModuleFileName,{k32,path,256+266}) name=peek({path,ret}) printf(1,"%s\n",{name}) sleep(3)