MQL5 dll (openwatcom)
//+------------------------------------------------------------------+
//| MQL5DLL Test.mq5 |
//| Copyright 2010, MetaQuotes Software Corp. |
//| http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "2010, MetaQuotes Software Corp."
#property link "http://www.mql5.com"
#property version "1.00"
//---
#import "watcomdll1.dll"
void SomeFunction(void);
#import
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//--- calling the function for calculations
SomeFunction();
//---
}
//+------------------------------------------------------------------+
#ifndef __MAIN_H__
#define __MAIN_H__
#include <windows.h>
/* To use this exported function of dll, include this header
* in your project.
*/
#ifdef BUILD_DLL
#define DLL_EXPORT __declspec(dllexport)
#else
#define DLL_EXPORT __declspec(dllimport)
#endif
#ifdef __cplusplus
extern "C"
{
#endif
//+------------------------------------------------------------------+
//|
//+------------------------------------------------------------------+
void DLL_EXPORT __stdcall SomeFunction(void);
//+------------------------------------------------------------------+
//|
//+------------------------------------------------------------------+
#ifdef __cplusplus
}
#endif
#endif // __MAIN_H__
#include "main.h"
//+------------------------------------------------------------------+
//| a sample exported function
//+------------------------------------------------------------------+
void DLL_EXPORT __stdcall SomeFunction(void)
{
MessageBoxA(0, "XXXX :)", "DLL Message", MB_OK | MB_ICONINFORMATION);
}
//+------------------------------------------------------------------+
//|
//+------------------------------------------------------------------+
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
// attach to process
// return FALSE to fail DLL load
break;
case DLL_PROCESS_DETACH:
// detach from process
break;
case DLL_THREAD_ATTACH:
// attach to thread
break;
case DLL_THREAD_DETACH:
// detach from thread
break;
}
return TRUE; // succesful
}