Re: Where is my DLL?
- Posted by "Juergen Luethje" <j.lue at gmx.de> Oct 19, 2005
- 557 views
Juergen Luethje wrote: > Robert Craig wrote: > >> Juergen Luethje wrote: <snip> >>> Rob, I just thought that I'd sleep better if you could confirm >>> that I'm not doing something potentially dangerous here. >> >> I'm not sure. If hDLL is greater than a 31-bit integer >> there will be trouble, since Euphoria requires it to be >> stored in floating-point form. You might need to call >> my C routine NewDouble() to create a proper Euphoria atom >> in floating-point form. > > I see, thanks. Unfortunately, I don't know how to do so. > Matt, can I use make_atom() in this situation, or is it "only" for > parameters? Sorry, I don't want to bother anyone. It's just that using the DLL instance handle currently seems to be the perfect solution for me, and its value is contained in my program -- I just can't access it. That really drives me crazy. I feel like a dog that sees and smells fresh meat, and then someone says: "No my dear, that's not for you." Now I tested the following, which *seems* to work. I use this include file in my Eu program: --------------------------[ dll_instance.e ]--------------------------
integer DLL_Instance_Hi, DLL_Instance_Lo -- DLL_Instance_Hi = 0 -- Initialize the variables only when -- DLL_Instance_Lo = 0 -- testing the program with the -- interpreter, *not* when compiling -- to a DLL! global function dll_instance() return DLL_Instance_Hi*#10000 + DLL_Instance_Lo end function
---------------------------------------------------------------------- After translating the program for Borland, in "main_.c" I added two lines to DllMain(), so that it looks like this: int __declspec (dllexport) __stdcall DllMain(int hDLL, int Reason, void *Reserved) { _9DLL_Instance_Hi = (hDLL >> 16) & 0xFFFF; // line added manually _9DLL_Instance_Lo = hDLL & 0xFFFF; // line added manually if (Reason == 1) EuInit(); return 1; } Could one of our experts please tell me whether this can be considered safe? Regards, Juergen -- Have you read a good program lately?