how to integrate matlab generated dll into visual studio /C++

We have a simple matlab script myscript.m that performs simple math functions that does not use matlab library function.
Converting myscript.m into c++ using the command line resulted generating myscript.dll. >> mcc -W cppli b:liba -T link:lib myscript.m
When we try to integrate this myscript.dll into visual studio VC++ project, we get the following errors.
testmyscript.obj : error LNK2019: unresolved external symbol _mxGetPi_proxy referenced in function _wmain testmyscript.obj : error LNK2019: unresolved external symbol _mxGetPr_proxy referenced in function _wmain testmyscript.obj : error LNK2019: unresolved external symbol _mxCreateDoubleMatrix_730_proxy referenced in function _wmain
The test project testmyscript is using following functions, the VC++ compliler is unable to resolve external symbols.
plhs = mxCreateDoubleMatrix(rows, cols, mxCOMPLEX); start_of_pr = (double *)mxGetPr(plhs); memcpy(start_of_pr, pr_data, rows * cols * sizeof(double) );
Can you suggest how to the fix the problem. This is experimental code may not answer why?
Need help with steps integrate mathlab generated dll onto visual c++ (VS) environment.
SW Version used: VS2010, Matlab R2012b Configured path for mathlab header files and libraries under visual studio.

 Respuesta aceptada

Friedrich
Friedrich el 16 de Abr. de 2013
Editada: Friedrich el 16 de Abr. de 2013
Hi,
you need to explictily link against mclmcrrt.lib and also against myscript.lib. The mclmcrrt.lib is located in the C:\Program Files\MATLAB\R2012b\extern\lib\win64\microsoft folder. Maybe win32 in the case you use 32bit MATLAB/MCR.
So under Linker -> General specify the folder ("additional library folders" or whatever the correct name is^^) where the mclmcrrt.lib is located and under Linker -> Input specify the mclmcrrt.lib as additional dependency.

Más respuestas (0)

Categorías

Más información sobre C Shared Library Integration en Centro de ayuda y File Exchange.

Productos

Preguntada:

el 16 de Abr. de 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by