c++ dll error

 

i wrote a simple dll to open an a file

tou.cpp

#include "tou.h"

void OpenFile(char* filename)
{

ShellExecute(NULL, "open", filename, 0, 0, SW_SHOWDEFAULT);

}

tou.h
#include <windows.h>
#include <shellapi.h>
#pragma comment(lib, "shell32.lib")
#ifndef TOU_H
#define TOU_H
extern "C" void _declspec(dllexport)OpenFile(char* filename);
#endif
i have build a dll. but when i use it from indicator it opened the file then mt4 crashed.

the some souce of the test indicator:

#import "tou.dll"
void OpenFile(string filename);
#import

any one give me some advice will be very appreciated. thank you.

 

extern "C" void _declspec(dllexport)OpenFile(char* filename);

The above looks "odd"...

The MT4 sample dll uses:

#define MT4_EXPFUNC __declspec(dllexport)

MT4_EXPFUNC char* __stdcall OpenFile(char *filename)

I have no idea if yours is "correct" or not.

Reason: