File Exchange

image thumbnail

From Fortran, call MATLAB Compiler C shared library

version 1.0.0.0 (3.92 KB) by George Thiers
Mixed Language Example: From Fortran, call MATLAB Compiler C shared library

2 Downloads

Updated 24 Jan 2008

No License

The MATLAB Compiler (v4, R14 onwards) can package MATLAB code into an executable or C/C++ shared library. Calling a C shared library from Fortran, however, can be difficult. The mixed-language issue is C vs. Fortran calling conventions. This is an example of how to call a MATLAB Compiler-generated C shared library from Fortran.

Cite As

George Thiers (2021). From Fortran, call MATLAB Compiler C shared library (https://www.mathworks.com/matlabcentral/fileexchange/18449-from-fortran-call-matlab-compiler-c-shared-library), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (1)

Jing Qian

I am trying to compile your fortran code with Intel Visual Fortran (shelled with MS visual studio 2010). But I got the following error:
error LNK2019: unresolved external symbol _mclInitializeApplication referenced in function MAIN__ fortran_useDeployedMATLAB.obj

error LNK2019: unresolved external symbol _libMatlabGoodnessInitialize referenced in function MAIN__ fortran_useDeployedMATLAB.obj

error LNK2019: unresolved external symbol _mxCreateDoubleMatrix_700 referenced in function MAIN__ fortran_useDeployedMATLAB.obj
.....

I guess I missed some library to include. Do you have any idea on it?
Thanks in advance!

MATLAB Release Compatibility
Created with R2007a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!