[c#] utilisation de dllimport
Bonsoir,
j'ai téléchargé un API pour le pilotage d'un écran VFD . ce téléchargement comporte :
- un DDL
- un fichier "Object File Library"
- un exemple en c++
je sais que pour pouvoir utliser cette API je dois utliser [dllImport], mais voilà ma connaissance s'arrête là .
Dois je mettre le DLL dans un répertoire et si oui lequel , j'utilise visual c#xpress ?
que dois je faire du fichier lb?
dois je déclarer des constantes dans mon programme et si oui lesquelles et comment ?
dans l'essemble joint qui est en c++ a quoi correspond le choix entre dllimport et dllexport;
A quoi correspond les instructions suivante
Code:
1 2 3 4 5 6 7
| #ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
} // extern "C"
#endif |
Afin de compléter ma demande je vous communique l'exemple en c++
Code:
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
| #ifndef __SG_VFD_H__
#define __SG_VFD_H__
#ifdef IMONVFD_EXPORT
#define IMONVFD_API __declspec(dllexport)
#else
#define IMONVFD_API __declspec(dllimport)
#endif
#define VFDHW_IMON_VFD 4
#ifdef __cplusplus
extern "C" {
#endif
///////////////////////////////////////////////
// Open VFD driver and initialize parameters.
// Call this method, when application starts.
// Return value informs driver is open or not
IMONVFD_API bool iMONVFD_Init(int vfdType, int resevered=0);
///////////////////////////////////////////////
// Close VFD driver.
// Call this method, when application destroyed.
IMONVFD_API void iMONVFD_Uninit(void);
///////////////////////////////////////////////
// Check if VFD driver is opened.
IMONVFD_API bool iMONVFD_IsInited(void);
///////////////////////////////////////////////
// Send text data to VFD. VFD supports only English character set.
IMONVFD_API bool iMONVFD_SetText(char* szFirstLine, char* szSecondLine);
///////////////////////////////////////////////
// Send EQ data to VFD.
// Total 16band, each band ranges from 0 to 100
// make EQ data with integer array.
IMONVFD_API bool iMONVFD_SetEQ(int* arEQValue);
#ifdef __cplusplus
} // extern "C"
#endif
#endif //__SG_VFD_H__ |