O.P. Getting unmanaged dll function params
I'm developing a plugin for msn, but my question isn't related to it directly so I ask it here...
I've got an unmanaged DLL (I guess it's written in C++). I've got some tools to view a list of functions that are in it. The function names describe the function good I hope, and there are some functions I would really like to use in my code. So I want to call them from my C# application. Of course I know I can call external functions like this:
[DllImport("MyDLL.DLL"]
public static extern bool ANiceFunction(String param);
But the problem is, I don't know the return type (bool in example above) and I don't know the params... I can guess the return type sometimes, but not always... I tried some things but I haven't been able to get a good reaction of the dll (for example when I try int as return type it always returns 0, although I expected 1 or 2)...
I don't think it is possible, but is there a way to detect what params and/or what return type the functions have?? I doesn't have to be C#, if there is another way to detect it, it is fine by me. Or is there a code that just tries several options and can tell me which is correct? It would really help me!!
P.S. There is absolutely no documentation about this dll so I have to find it myself...
|