Operating a C++ class from Matlab without mex -
is there alternative way call c++ class using matlab, , operate methods on matlab variables?
you can use calllib call functions in shared library.
this newlib.h
#ifdef __cplusplus extern "c"{ #endif void *init(int device); #ifdef __cplusplus } #endif and newlib.cpp file
#include "newlib.h" #include "yourlib.h" *p; extern "c" void *init(int device) { p = new a; p->yourfunction(device); } then in matlab
clc lib_name='libnewlib'; inc_name='newlib.h'; loadlibrary(lib_name,inc_name); device = 0; calllib(lib_name,'init', device); unloadlibrary(lib_name); this has been working fine me.
Comments
Post a Comment