using a DLL in VisualC++
Posted on 2003-03-31
I have some trouble with calling a DLL in Visual C++. Please help me!
I've written a program in VisualC++ to call a DLL file. I came to the DLL file by compiling a Matlab file with the function mcc. When I write a simple DLL file (output=input) my C++ program works very well and gets a good link with the DLL. But when I change the DLL file a little bit(output = 3* input), my program gets no good link with the DLL file. It seems that the main function can't call the other subfunctions of my dll file(the functions that are extra created when I changed my DLL file to "output=3*input" and are needed to perform the multiplication)
Please, can you explain me what's wrong, what I have to change??
Is their something wrong with the settings of my program?
Could you give me a good example of such a program?
Is there maybe something wrong with the mcc compiler code?
The code I used was "mcc -W lib:libFLOPS -t -h -T link:lib libmmfile.mlib FLOPS".
This is a part of my C++ program:
typedef mxArray*(* LPFNDLLFUNC1)(mxArray* input);
HINSTANCE hDLL; // Handle to DLL
LPFNDLLFUNC1 lpfnDllFunc1; // Function pointer
hDLL = LoadLibrary("libFLOPS.dll");
if (hDLL != NULL)
lpfnDllFunc1 = (LPFNDLLFUNC1)GetProcAddress(hDLL,"mlfFLOPS");
// handle the error
SetDlgItemText(IDC_RESULTDLLCALL,"ddl found, but no function");
// call the function
SetDlgItemText(IDC_RESULTDLLCALL,"ddl en functie gevonden");
Thanx for your support ,