tags:

views:

26

answers:

2

Hey, I was add to my program reference to dll and it's work good. Declare Function adc11_get_driver_version Lib "C:\example.dll" () As Integer

but I want to write the specific location of the dll from file(config file) and replace the "C:\example.dll" by string

how can I do this? thanks

Saar

A: 

If you leave out the location completely, it will load it based on the current directory of the application. If it's not there, then it looks in the PATH.

If you want to do something more complex, then you need to write the LoadLibrary and GetProcAddress calls yourself in your own proxy.

Some guidance here:

http://www.codeproject.com/KB/cs/dyninvok.aspx

Lou Franco
A: 

I think you need to do dynamic PInvoke. One way to do this is using the LoadLibrary function to load the library before .Net tries to find it. You can find some sample code here.

ho1
thanks this works good
Saar