Re: Where is my DLL?

new topic     » goto parent     » topic index » view thread      » older message » newer message

Me wrote:

[How can a DLL written in Euphoria get its own instance handle?]

<snip>

> Now I've found a (hopefully correct) way to fetch the value of
> [the first parameter of DllMain()/LibMain()] so that I can use
> it in my Eu DLL.
> I wrote the following small include file:
>
> --------------------------[ dll_instance.e ]--------------------------
> }}}
<eucode>
> atom DLL_Instance
> -- DLL_Instance = 0             -- Initialize the variable only when
>                                 -- testing the program with the
>                                 -- interpreter, *not* when compiling
>                                 -- to a DLL!
> global function dll_instance()
>    return DLL_Instance
> end function
> </eucode>
{{{

> ----------------------------------------------------------------------
>
> I include this file in the code of my DLL, and after translation,
> in the file "main_.c" I add something like
>
>     _2DLL_Instance = hDLL;
>
> as the first line to either DllMain() or LibMain().
> When dll_instance.e is not the 1st but the 2nd included file, then
> the number must be not 2, but 3 etc. A small Eu program does it for me.
>
> This seems to work fine so far. Unfortunately, I always have to
> uncomment the line in the include file that initializes the variable
> 'DLL_Instance', before I can run the code with the interpreter.

<snip>

Rob, I just thought that I'd sleep better if you could confirm that I'm
not doing something potentially dangerous here. smile

Regards,
   Juergen

-- 
Have you read a good program lately?

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu