Loading Multiple Instances of DLL

Loading Multiple Instances of DLL

am 08.10.2007 22:53:56 von Michael Hesse

Hi,

I need to use two versions of the same DLL in a VB.Net application. I know
how to load one version:

Public Declare Function DoSomething Lib "MyDLL.Dll" () As Double

However if I try to also load:

Public Declare Function DoSomething Lib "MyOtherDLL.Dll" () As Double

I end up with 2 functions with the same name.

How do I get around this?

Thanks,

Michael

Re: Loading Multiple Instances of DLL

am 09.10.2007 05:43:03 von mattias.dont.want.spam

Michael,

>I need to use two versions of the same DLL in a VB.Net application. I know
>how to load one version:
>
> Public Declare Function DoSomething Lib "MyDLL.Dll" () As Double
>
>However if I try to also load:
>
> Public Declare Function DoSomething Lib "MyOtherDLL.Dll" () As Double
>
>I end up with 2 functions with the same name.
>
>How do I get around this?

Put the Declare statements in two different classes, or use the Alias
clause to separate them

Public Declare Function Foo Lib "MyDLL.Dll" Alias "DoSomething" () As
Double

Public Declare Function Bar Lib "MyOtherDLL.Dll" Alias "DoSomething"
() As Double


Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.