Re: Where is my DLL?

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

Me wrote:

> Me wrote:
>
> <snip>
>
>> 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 I pass the result of Euphoria's instance() function as the module
>> handle parameter, GetModuleFileName() also returns the path of the EXE
>> file instead the path of the DLL.
>
> <snip>
>
> Now I looked at the C code produced by the translator.
> In main_.c it reads:
>
> <C code>
> int __declspec (dllexport) __stdcall DllMain(int hDLL, int Reason, void
> *Reserved)
> {
>     if (Reason == 1)
>         EuInit();
>     return 1;
> }
> </C code>
>
> Maybe it's possible to manually add some C code that fetches the value
> of 'hDLL', so that I can use it in my Euphoria code? The problem is that
> I know almost nothing about C. Can someone tell me how to do so?

I looks as if I've got it! smile)

In my Eu program, I just defined a variable
    global atom DLL_Instance

Although I did not assign a value to the variable, I could use it in my
program, and the program translated without error. Then after translation,
I added one line to the above function:

<C code>
int __declspec (dllexport) __stdcall DllMain(int hDLL, int Reason, void
*Reserved)
{
    _1DLL_Instance = hDLL;

    if (Reason == 1)
        EuInit();
    return 1;
}
</C code>

Rob, it looks as if it would be not much work to implement a
function dll_instance() in the next Euphoria relase. Pleeease. 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