including .dll file in MQL5\ Libraries folder - page 2

 
#include "main.h"
#include "utils.h"

// a sample exported function
void DLL_EXPORT fnFillArray(int *arr,const int arr_size)
{
  //--- check for the input parameters
   if(arr==NULL || arr_size<1) return;
  //--- fill array with values
   for(int i=0;i<arr_size;i++) arr[i]=i;
}

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
}