>How I can write somthing like this:
>[DllImport("%ProgramFiles%\\aaa.dll")]
>
>where %ProgramFiles% - some DOS variable?
You can't. What you can do instead is is to just use
[DllImport("aaa.dll")], and then explicitly load the DLL with
LoadLibrary before using it.
Mattias

Signature
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Dmitry Dorobin - 04 Apr 2007 14:52 GMT
> >How I can write somthing like this:
> >[DllImport("%ProgramFiles%\\aaa.dll")]
[quoted text clipped - 4 lines]
> [DllImport("aaa.dll")], and then explicitly load the DLL with
> LoadLibrary before using it.
Oh! Sorry for stupid question... Can you show me how I can do this?
Something like this doesn't work correct...
[DllImport("kernel32.dll")]
static extern IntPtr LoadLibrary(string lpFileName);
[DllImport("aaa.dll")]
static extern void bbb();
void main()
{
IntPtr lib = LoadLibrary("C:\\Program Files\\...Some path...\\aaa.dll");
bbb();
}