Click to See Complete Forum and Search --> : dllimport


mohamed123
February 29th, 2008, 08:37 AM
Hi

I use C# wrapper classes from a SDK in my C# application

This wrapper is using dllimport to load DLLs

When i run my app , it complains , these Dlls cannot be found

I dont know how to set the path where the dllimport will look for the dlls
I did set the PATH variable from RightCLick->MyComputer , but no change

in Visual Studio 2003.NET for C#.NET applicatiion

or should i manually copy these Dlls in System32 folder

Regards

TheCPUWizard
February 29th, 2008, 08:55 AM
For problems like this you should ALWAYS post the exact error message (copy&paste), as well as the code (using code-tags of course).

If you are refrencing aaa.dll, which in turn references bbb.dll you may get error messages related to aaa.dll when in fact the problem is that bbb.dll can not be found [that is twhy there is Depends.exe]

Also copying to system32 should NOT be done for "normal" non-shared items. As a first atempt I would try copying them locally.

Also run from within the IDE debugger, and pay CAREFUL attention to the Output window.

mohamed123
February 29th, 2008, 09:10 AM
or to put simly

DllImport("MyDLL.Dll", ....... );

does not find MyDll.dll

but if put

DllImport("C:\\MyDLLS\\MyDLL.Dll", ....... );
i.e hard code the path , alls well