Call .c function in working directory
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello!
I am in way over my head trying to call a .c function in a running script.
The code is about 20 years old now and I am updating it to run on the current 2021 platform on a Mac.
Basically in this working folder I have 2 files "code.c" and "code.dll" and I amd trying to use the them in the context
z=code(x,y);
at the top of the code.c is a header:
#include <math.h>
#include "mex.h"
Ive tried simply calling the function like the following after installing code compiler:
mex code.c
Which then pops the error message of needing a compiler. I really dont want to search to find one that works with a Mac at a low storage space.
Is there any way around this?
1 Kommentar
Walter Roberson
am 26 Jun. 2021
Mac does not use .dll files. Mac uses .dylib (dynamic link library) and .a (static link library) files; also dynamically loadable bundles might be .so (see https://docstore.mik.ua/orelly/unix3/mac/ch05_03.htm )
Antworten (1)
Jan
am 26 Jun. 2021
Bearbeitet: Jan
am 26 Jun. 2021
Please post a copy of the error message, not a rough paraphrasation.
"needing a compiler" seems to mean, that you did not install a compiler, which is recognized by Matlab. I guess that " current 2021 platform on a Mac" means Matlab R2021a, but what does "Mac at a low storage space" exactly mean? You need XCode 11 or 12, see: https://www.mathworks.com/support/requirements/supported-compilers.html
3 Kommentare
Siehe auch
Kategorien
Mehr zu Write C Functions Callable from MATLAB (MEX Files) finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!