loadlibrary and preprocessor #define
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi!
My basic problem is that I cannot get loadlibrary to define a symbol to be set when parsing an .h-file. Is there any way to set such a define from Matlab that I have missed?
As a workaround I tried to make loadlibrary use a special .h-file that in itself set the defines like this and in turn includes the real .h-file:
// matlabIncludeFile.h
#define MATLAB_ONLY
#include "realIncludeFile.h"
// realIncludeFile.h
#ifdef MATLAB_ONLY
...
//What I want matlab to see
...
#else
...
//What I want all other compilers to see
...
#endif
But here it seems like a bug because realIncludeFile.h is parsed as if MATLAB_ONLY is not defined. If I move #define MATLAB_ONLY from matlabIncludeFile.h to realIncludeFile.h it works but that of course defeats my goal of having a specific define set when parsing via Matlab.
I have other options but they don't appeal to me for various reasons such as:
- Different include directories for matlab and not-matlab parsing
- A #ifndef and compiler constant in commandline of all other compilers.
Any suggestions to solve my original problem? For example, does Matlab set up a specfic predefined macros such as GCC's _GNUC_?
0 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre C Shared Library Integration en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!