MATLAB Answers

S Function Error while generationg mex file

1 view (last 30 days)
Sunu
Sunu on 29 Apr 2013
I have a header file with a prototype of a function( myfunc)and a function ponter to it. The c code generated with call through the function pointer to the myfunc inside the s19 file.
I get the following error while doing the legacy_code('compile', def) Error EH_fltPOW_flt_flt.c: 184 operands of = have illegal types `float' and `pointer to float function(float,float)' .

  3 Comments

Kaustubha Govind
Kaustubha Govind on 30 Apr 2013
Please also paste the prototype of the C function you are trying to call out, and the exact Legacy Code Tool commands that you are using.
Sunu
Sunu on 1 May 2013
def.OutputFcnSpec='single y1=EH_fltPOW_flt_flt(single u1, single u2)'
def.HeaderFiles={'myfunction.h'}
myfunction.h has
typedef float (*EH_fltPOW_flt_flt_type)(float, float);
#define EH_fltPOW_flt_flt ((EH_fltPOW_flt_flt_type)(0x66f74));
legacy_code('sfcn_cmex_generate', def); legacy_code('compile', def);
thats when I get the error mentioned
Kaustubha Govind
Kaustubha Govind on 1 May 2013
Seems like there might be a problem with how the function pointer is defined. Are you able to write and compile C code separately that attempts to call into the function-pointer? If so, how do you call into it?

Sign in to comment.

Answers (0)

Sign in to answer this question.

Products