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 51 52 53 54 55 56 57 58 59 60 61 62
| // .h ////////////////////////////////
#ifndef _DLL_H_
#define _DLL_H_
#if BUILDING_DLL
# define DLLIMPORT __declspec (dllexport)
#else /* Not BUILDING_DLL */
# define DLLIMPORT __declspec (dllimport)
#endif /* Not BUILDING_DLL */
typedef struct {
int ObjType; // object type
int AddrHigh; // object address - high byte
int AddrLow; // object address - low byte
int Index; // index address for object arrays
union {
long int I; // object value - integer
double D; // object value - double/single
} Val;
int Exponent; // object value - exponent
int BitNumber; // specific bit number
} KN_OBJ;
DLLIMPORT void FonctionAffiche ( KN_OBJ * Test );
#endif /* _DLL_H_ */
// .c ////////////////////////////////
#include "dll.h"
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
DLLIMPORT void FonctionAffiche ( KN_OBJ * Test )
{
printf(" %i %i %i %i %Id %lf %i %i \n" , Test->ObjType , Test->AddrHigh , Test->AddrLow ,
Test->Index , Test->Val.I , Test->Val.D , Test->Exponent ,
Test->BitNumber );
}
BOOL APIENTRY DllMain (HINSTANCE hInst /* Library instance handle. */ ,
DWORD reason /* Reason this function is being called. */ ,
LPVOID reserved /* Not used. */ )
{
switch (reason)
{
case DLL_PROCESS_ATTACH:
break;
case DLL_PROCESS_DETACH:
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
}
/* Returns TRUE on success, FALSE on failure */
return TRUE;
} |
Partager