Nicholas Paldino [.NET MVP]
10/18/2002 2:32:00 PM
Yawen,
If you make two calls into the DLL, the DLL should only be loaded once
into memory.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- nicholas.paldino@exisconsulting.com
"Yawen Chan" <y3chan@engmail.uwaterloo.ca> wrote in message
news:OsiQ7MmdCHA.2008@tkmsftngp08...
> I'm using PInvoke to call a function in a DLL. But now I have 2 functions
> from the DLL that I want to call. When I declare the C function
prototype,
> I do:
>
> [DllImport("SampleDLL")]
> private static extern void functionA();
> private static extern void functionB();
>
> Then when I run it, I got an System.TypeLoadException.
>
> However I found that if I do:
>
> [DllImport("SampleDLL")]
> private static extern void functionA();
> [DllImport("SampleDLL")]
> private static extern void functionB();
>
> My application runs just fine.
>
> So now I'm concerning about the performance of my application. If I call
> DllImport twice, does it mean that the DLL is loaded twice? If so, how
can
> I just load the DLL once in this case?
>
> Thanks very much.
>
> Yawen
>
>
>
>