i have a c++ dll. i have to use this dll in c# code. in this dll:
struct UserRecord
{
int login;
//some properties here
}
struct CServerInterface
{
int __stdcall ClientsAddUser(UserRecord *inf);
//some other functions here
}
How can i call a function in a struct? I try this:
[DllImport("WebRegistration.dll")]
public extern static int ClientsAddUser(ref UserRecord inf);
public struct UserRecord
{
//properties here
}
static void Main(string[] args)
{
UserRecord user = new UserRecord();
ClientsAddUser(ref user);
}
throws exception: "Unable to find an entry point named 'ClientsAddUser' in DLL".
I suppose that if this function was not in a struct, i would not throw an exception.
I'm a newbee, but try this; Make CServerInterface and UserRecord, "public class". An example;