1
과 함께 호출하면 C++ DLL이 생깁니다. C# 코드에서이 DLL을 사용해야합니다. 이 DLL에서 :구조체에서 C++ 함수를 C#
struct UserRecord
{
int login;
//some properties here
}
struct CServerInterface
{
int __stdcall ClientsAddUser(UserRecord *inf);
//some other functions here
}
struct에서 함수를 어떻게 호출 할 수 있습니까? 나는이 시도 :
[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);
}
에서 예외가 발생합니다 : "DLL에서 'ClientsAddUser'라는 진입 점을 찾을 수 없습니다."
이 함수가 구조체에 없으면 예외가 발생하지 않는다고 가정합니다.
그래, 그럴 일은 없을 것입니다. C++이기 때문에, 맹 글링 된 이름 (문제가있는 경우)을 찾아야합니다. 'CServerInterface'를 COM 객체로 내보내는 것이 더 운이 좋을지도 모릅니다. – leppie