mex shared library on Linux, __attribute__ ((visibility ("default"))) problem

6 views (last 30 days)
There is no problem on windows but on linux i got these
i use gcc 4.7 on ubuntu I successful compile C source file with mex command but when i try to loadlibrary i got this error message
Type '' was not found. Defaulting to type error. Failed to parse type '( visibility (" default "))) int NumberOfSetBits ( int' original input '( visibility ...
I try to compile shrlibsample too but i got warning 'no function exist' message
Sorry my bad english
MyFunc.c
#include <stdio.h>
#include <mex.h>
#include "MyFunc.h"
__attribute__ ((visibility ("default"))) int NumberOfSetBits(int i)
{
i = i - ((i >> 1) & 0x55555555);
i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
return (((i + (i >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
}
void mexFunction( int nlhs, mxArray *plhs[],
int nrhs, const mxArray*prhs[] )
{
}
MyFunc.h
__attribute__ ((visibility ("default"))) int NumberOfSetBits(int);

Answers (0)

Categories

Find more on Write C Functions Callable from MATLAB (MEX Files) in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!