LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

GetExternalModuleAddr

We have a server application that dynamically loads drivers at startup. We are searching a folder for .lib files then calling LoadExternalModule to load the library and then calling a common function to all the libraries. What I would like to do it move all the .lib files and their coresponding DLL files to a seperate folder to keep the program dir clean but then the GetExternalModuleAddr can't find the DLLs.
 
Moving all the .lib files is ok because we specify the path to the lib files in LoadExternalModule and it is able to load the libs but when we try to get a handle to a function inside the coresponding dll the GetExternalModuleAddr is not smart enough to look for the dll in the same folder as the lib, it seems to only check the windows/system folder and the same folder as the exe.
 
Is there a way to add a folder to the search path for the dll file or to explicitly tell GetExternalModuleAddr where the dll file is located?
 
Thanks
Tyler
0 Kudos
Message 1 of 6
(3,744 Views)

Hello Tyler,

 

Thank you for posting to the NI Discussion Forums!  Unfortunately I do not believe that there is a way to modify the manner in which that function behaves.  To get around this problem, I recommend using LoadLibrary and GetProcAddress instead.  Ultimately you’re going to be loading the dll anyway because using the “loadexternalmodule” will call LoadLibrary if the .lib file is just an import library.

 

Hopefully this will resolve the problem.  Please let me know if this helps-

Travis M
LabVIEW R&D
National Instruments
0 Kudos
Message 2 of 6
(3,719 Views)
The two functions Travis mentioned are Windows SDk functions. You will need to include windows.h as the very first header in your includes list to use these functions.

Message Edited by bilalD on 05-02-2006 08:54 AM

Bilal Durrani
NI
0 Kudos
Message 3 of 6
(3,697 Views)

Thank you,

I'v been searching for info on these functions in CVI help with no sucess, now it all makes sence. Can anyone point me to an example?

Tyler

0 Kudos
Message 4 of 6
(3,693 Views)
0 Kudos
Message 5 of 6
(3,685 Views)

Also see this document


 
Bilal Durrani
NI
0 Kudos
Message 6 of 6
(3,672 Views)