Problems with Call DLL function

Got a problem you cannot solve? Try here.
Post Reply
Mateo
Posts: 20
Joined: Tue Aug 21, 2007 10:15 am

Problems with Call DLL function

Post by Mateo »

Hi,

I'm having problems calling a function from a dll. I wrote a dll that brings up a dialog box that allows the user to select which Palm user they would like to install my Palm extensions to. It works perfectly when I run it from rundll32.exe (It's how i test my functions that are in dlls). When I put it into an installer and run it fails to load with a return value of DLLLOADFAILED. I tracked it down to the fact that my dll can not load functions from another dll. Both dlls are in the $SUPPORTDIR$.

I'm guessing my problem is that the support dir is not the current working directory when I'm calling my dll so it can't find the other dll (Instaide.dll for any palm developers out there.)

Any ideas how I can fix it?
Mateo
Posts: 20
Joined: Tue Aug 21, 2007 10:15 am

Post by Mateo »

I found a solution to my problem. It's not pretty but it seems to work.
I called SetDllDirectory ( http://msdn.microsoft.com/en-us/library ... S.85).aspx )from my installer right before I call my own dll and pass it $SUPPORTDIR$.

What I should have done if I had the time was use LoadLibrary and GetProcAddress instead of linking against instaide.lib. That way I could call SetDllDirectory from within my dll. *shrugs* but it works. :D
Post Reply