1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
#include <stdio.h>
#include <windows.h>
#include <stdlib.h>
typedef int (*MYPROC)(short int* ,short int* , double* , double* , double*);
int main() {
short int* N1 = malloc(1*sizeof(short int));
short int* N2 = malloc(30*sizeof(short int));
double* N3 = malloc(30*sizeof(double));
double* N4 = malloc(1*sizeof(double));
double* N5 = malloc(1*sizeof(double));
//def les constantes
HINSTANCE hinstLib;
MYPROC ProcAdd;
BOOL fFreeResult, fRunTimeLinkSuccess = FALSE;
// Get a handle to the DLL module.
hinstLib = LoadLibrary(TEXT("DDL_Excel.dll"));
// If the handle is valid, try to get the function address.
if (hinstLib != NULL)
{
// printf("OK lib\n");
ProcAdd = (MYPROC) GetProcAddress(hinstLib, TEXT("Flash"));
// If the function address is valid, call the function.
if (NULL != ProcAdd)
{
// printf("OK procAdd\n");
fRunTimeLinkSuccess = TRUE;
ProcAdd(N1,N2,N3,N4,N5);
}
// Free the DLL module.
fFreeResult = FreeLibrary(hinstLib);
}
// If unable to call the DLL function, use an alternative.
if (! fRunTimeLinkSuccess)
printf("Message via alternative method\n");
return 0;
} |