MATLAB Answers


Calling a C function from MATLAB

Asked by seldeeno
on 22 Apr 2013


I have one question: While I successfully create a dll file for my C file via MinGW, whenever I call my file with certain parameters I keep getting an error that is related to that this code in C returns NULL , any ideas please?

 #ifdef WINDOWS
  hLibrary = LoadLibrary ("fcnsuite.dll");
  hLibrary = dlopen ("./", RTLD_NOW);

And this gives "failed to load procedure"!!!


What you are saying is exactly what I have and the loadLibrary is the thing that is not getting the dll right and hence says that the procedure in the library is not found:

"procedure g06 not found in library file!Error using mlbsuite failed to load procedure"

Jan Simon
on 23 Apr 2013

In which folders does LoadLibrary look for this dll-file?

It is in the same folder as the C and .m files


No products are associated with this question.

1 Answer

Answer by seldeeno
on 23 Apr 2013

Ok people I got it to work. Actually I had to create the dll of the function using a command like: mbuild file1.c file1.exports with function names in this file1.exports and that did the trick

Thank you all for your comments!


Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!