Fábio Chicout
2010-02-05 13:29:47 UTC
I'm having some issues now that I can't see what I'm doing wrong.
I'm Pinvoking a non WindowsAPI-DLL (I mean, not a dll provided on windows).
Pinvoking LoadLibrary, I can get a IntPtr to any WindowsAPI-DLL, but never I
can get a pointer to my DLL.
The code I'm using is very simple, like this one:
[DllImport("kernel32.dll", SetLastError=true)]
public static extern IntPtr LoadLibrary();
static void Main(string[] args){
IntPtr libPtr = LoadLibrary(<path to the dll>);
Console.WriteLine(libPtr);
}
This code is only to test if the library was read. When calling
Marshal.GetLastWin32Error(), i got the error 126. I've googled, but found
nothing more than this link:
http://msdn.microsoft.com/en-us/library/ms681382%28VS.85%29.aspx
Any Ideas?
I'm Pinvoking a non WindowsAPI-DLL (I mean, not a dll provided on windows).
Pinvoking LoadLibrary, I can get a IntPtr to any WindowsAPI-DLL, but never I
can get a pointer to my DLL.
The code I'm using is very simple, like this one:
[DllImport("kernel32.dll", SetLastError=true)]
public static extern IntPtr LoadLibrary();
static void Main(string[] args){
IntPtr libPtr = LoadLibrary(<path to the dll>);
Console.WriteLine(libPtr);
}
This code is only to test if the library was read. When calling
Marshal.GetLastWin32Error(), i got the error 126. I've googled, but found
nothing more than this link:
http://msdn.microsoft.com/en-us/library/ms681382%28VS.85%29.aspx
Any Ideas?