Parameter delcarations for imported dll functions

 
I've been having some problems calling some functions I've written and put in a dll file (written in vs2005c++). My .cpp file definition looks like this:

__declspec(dllexport) void recordTrade(int a, int b, char* c, double d, double e);

mq4 file looks like this:

#import "myfile.dll"
void recordTrade(int a, int b, string c, double d, double e);
#import

I then call the function in Init() instead of start() (just for testing purposes):

recordTrade(10000, 1031, "USD/JPY", 118.67, 117.67);

The function gets called and performs its operations correctly. I've verified it through my demo account broker software. Once the function finishes mt4 crashes and it gives me an error from this function on the call stack:

Call stack :
004534B0:019E [0045364E] ?InitFunctionInt@CExpertInterior

I finally tried rewriting the function to not include any parameters and just hardcoded dummy values in the function to pass to my broker so the .cpp now looks like:

__declspec(dllexport) void recordTrade();

the mq4 file is now:

#import "myfile.dll"
void recordTrade();
#import

and the function call looks like:

recordTrade();

This actually works. By not passing any parameters, I can successfully call my function from mt4. But this isn't very useful. I need the info from mt4. Can anybody see what I'm doing wrong? Do I need to pass parameters by pointer? Or do I have to make them constant? I've looked at the samples included but can't figure out what the difference is. Any help or guesses would be appreciated.

Thanks
 
Well I feel stupid. I forgot the __stdcall before my function declaration. For anyone else having problems with dll's your function declaration in your .cpp file should look like this.

__declspec(dllexport) __stdcall void recordTrade(int a, int b, char* c, double d, double e);

Ugh... I hate programming!!! I spent days looking for this too!