Contents - Index


DLL File Skeleton in Visual C++

 

#include <windows.h>

#include <math.h>

 

// Defines the entry point for the dll

BOOL APIENTRY DllMain( HANDLE hModule, 

                       DWORD  ul_reason_for_call, 

                       LPVOID lpReserved

          )

{

    return TRUE;

}

 

// Tell EES which functions and procedures are exported in the library :

// List of DLF format functions

__declspec(dllexport) void DLFNames(char* Names)

{

 strcpy(Names,"myFunc1,myFunc2");

}

 

// List of DLP format procedures

__declspec(dllexport) void DLPNames(char* Names)

{

 strcpy(Names,"myDLP");

}

 

// List of FDL format procedures

__declspec(dllexport) void FDLNames(char* Names)

{

 strcpy(Names,"myFDL");

}

 

 

// DLF functions implementation

__declspec(dllexport) double myFunc1(char s[256], int& mode, EES_PARAM_REC *rec_in)

{Code for myFunc1}

    ...

    ...

 return;

}

 

__declspec(dllexport) double myFunc2(char s[256], int& mode, EES_PARAM_REC *rec_in)

{Code for myFunc2}

    ...

    ...

 return;

}

// DLP procedure implementation

__declspec(dllexport) void myDLP(char s[256], int& mode, EES_PARAM_REC *rec_in, EES_PARAM_REC *rec_out)

{Code for myDLP}

    ...

    ...

  return;

 }

 

// FDL procedures implementation (FORTRAN style)

// Note : fortran is always passing the length of the string after

// a string parameter. FORTRAN is always expecting parameters to be

// passed by reference

//

__declspec(dllexport) void myFDL(char s[256], int& clen, int& mode, 

 int& NInputs, double inputs[25], int& NOutputs, double outputs[25])

{

{Code for myDLP}

    ...

    ...

  return;

 }

 

Multiple External Routines in a Single DLL