Problem with accessing DLL functions
Hi!
I’m attempting to translate currently-functional c-mex s-function code (from the Matlab platform) into regular C code. In that c-mex s-function code, the following sequence works to access the functions within my .dll:
Code:
HINSTANCE dll;
typedef bool (*fcn1WrapperPointer)(int numInputs, int numOutputs, char *fileName);
fcn1WrapperPointer fcn1Wrapper; /* Pointer to "fcn1Wrapper" function within the .dll */
mdlStart(…){ /* equivalent of main() in C */
dll = LoadLibrary("myLibrary.dll");
fcn1Wrapper = (fcn1WrapperPointer)GetProcAddress(dll, "fcn1Wrapper");
/* call fcn1() */
fcn1Wrapper(…);
}
However, in my C code, when I place the following declarations in my global workspace:
Code:
line 31: HINSTANCE dll; /* mydll.dll exports a function called _addInts */
line 33: extern "C" __declspec(dll) bool (*fcn1WrapperPointer)(int numInputs, int numOutputs, char *fileName);
main(){
dll = LoadLibrary("myLibrary.dll");
}
… I get the compiler (gcc) error:
line 33: error: expected identified or '(' before string constant
I’ve searched around for solutions to this error, and it seems that there are numerous possible causes; however, none of the suggested solutions has resolved this error.
In case it’s relevant, the .dll was compiled using Visual C++ 2008 Express Edition, and again, my c-mex s-function code has had no problems with calling this .dll’s functions. I believe that I've declared all of the necessary headers.
Any suggestions? Thanks in advance for your advice.