Sunday, January 12, 2014

vs and matlab mixed programming

Encounter the following error when using vs and Matlab programming, please adequate guidance:
A, BOOL WINAPI DllMain (HINSTANCE hInstance, DWORD dwReason, void * pv)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
if (GetModuleFileName (hInstance, path_to_dll, _MAX_PATH) == 0)
return FALSE;
}
else if (dwReason == DLL_PROCESS_DETACH)
{
}
return TRUE;
}
Error 1 error C2664: "GetModuleFileNameW": can not convert parameter 2 from "char [260]" convert "LPWSTR" C: \ Program Files \ MATLAB \ R2011b \ bin \ libMyAdd.cpp
Two, bool MW_CALL_CONV libMyAddInitializeWithHandlers (
mclOutputHandlerFcn error_handler,
mclOutputHandlerFcn print_handler)
{
int bResult = 0;
if (_mcr_inst! = NULL)
return true;
if (! mclmcrInitialize ())
return false;
if (! GetModuleFileName (GetModuleHandle (" libMyAdd "), path_to_dll , _MAX_PATH)) < br />return false;
bResult = mclInitializeComponentInstanceNonEmbeddedStandalone (& _mcr_inst,
path_to_dll,
"LibMyAdd",
LibTarget,
error_handler,
print_handler);
if (! bResult)
return false;
return true;
} Error 2 error C2664: "GetModuleHandleW": can not convert parameter 1 from "const char [9]" convert "LPCWSTR" C: \ Program Files \ MATLAB \ R2011b \ bin \ libMyAdd.cpp 85
Reply:
Project property is set to UNICODE

No comments:

Post a Comment