Home > Back-end >  Consult c DLL using MFC methods in the static library is used to derive the class contains static fu
Consult c DLL using MFC methods in the static library is used to derive the class contains static fu

Time:10-13

DLL source file:
Ctest class _declspec (dllexport)
{
Public:
The static test ctest * ();

String _stdcall add (string a, string b)
{
return a+b;
}
};
Ctest * ctest: : test ()
{
Return new ctest ();
}
The test program:
Ctest class _declspec (dllexport)
{
Public:
String _stdcall add (string a, string b);
The static test ctest * ();
};
Int _tmain (int arg c, _TCHAR * argv [])
{
Ctest * test=ctest: : test ();
Coutreturn 0;
}

An error occurred when the cout is as follows:



CodePudding user response:

First post forget details:
In "using the standard Windows library" I compile DLL under the condition of no problem, but using static library in the use of MFC "compiled DLL will go wrong, when hope prawns for help

CodePudding user response:

DLL interface is C style, the class can't exist, or pit is everywhere,

String _stdcall add (string a, string b); The static link library operation, the function is as long as there will be a problem,

CodePudding user response:

I also tested the
String _stdcall add (string a, string b);
Modified to char * _stdcall add (char * a, char * b);
You can, as if can only pass the built-in types, references can also be instead

CodePudding user response:

The same demand, who can help me answer the ha
  • Related