I have a abc.cpp file and abc.h file.
In abc.cpp file declare functions which are defined in myDLL.dll.
abc.h file is..
#ifndef _DERMALOGFINGERCODE3_H_
#define _DERMALOGFINGERCODE3_H_
#include "ABCSDK_Definitions.h"
#include "ErrorCodes.h"
#include "BitmapInfoHeader.hpp"
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
typedef void* FC3_t;
typedef FC3_t FC3Template_t;
typedef FC3_t FC3Encode_t;
typedef FC3_t FC3Match_t;
DrmErrorCode_t DRMAPI FC3Initialize(const char* szReserved);
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // _DERMALOGFINGERCODE3_H_
ErrorCodes.h file is
#ifndef _ERRORCODES_H_
#define _ERRORCODES_H_
#include <stddef.h>
typedef long DrmErrorCode_t;#endif /* _ERRORCODES_H_*/
ABCSDK_Definitions.h file is
#ifndef _DERMALOGSDK_DEFINITIONS_H_
#define _DERMALOGSDK_DEFINITIONS_H_
#ifndef DRMAPI
#if defined(WIN32) || defined(_WIN32)
#define DRMAPI __stdcall
#else
#define DRMAPI
#endif
#endif
typedef enum { eLong, eDouble, eString } enumType_t;
typedef enum { eNone, eIn, eOut,eInOut } enumAccess_t;
#endif // _DERMALOGSDK_DEFINITIONS_H_
BitmapInfoHeader.hppfile is
#ifndef _BITMAPINFOHEADER_HPP_
#define _BITMAPINFOHEADER_HPP_
#ifdef WINCE
#define BI_RLE8 (1L)
#endif
#if !defined(WIN32) || defined(__CYGWIN__)
#define WINAPI
#define BI_RGB (0u)
#define BI_RLE8 (1u)
#define BI_RLE4 (2u)
#define BI_BITFIELDS (3u)
#define BI_JPEG (4u)
#define BI_PNG (5u)
#include <inttypes.h>
#ifndef DWORD
typedef uint32_t DWORD;
#endif
#ifndef WORD
typedef uint16_t WORD;
#endif
#ifndef BYTE
typedef uint8_t BYTE;
#endif
#ifndef LONG
typedef int32_t LONG;
#endif
#ifndef BOOL
typedef int32_t BOOL;
#endif
#ifndef HMODULE
typedef void* HMODULE;
#endif
typedef struct tagBITMAPINFOHEADER{
DWORD biSize;
LONG biWidth;
LONG biHeight;
WORD biPlanes;
WORD biBitCount;
DWORD biCompression;
DWORD biSizeImage;
LONG biXPelsPerMeter;
LONG biYPelsPerMeter;
DWORD biClrUsed;
DWORD biClrImportant;
} BITMAPINFOHEADER;
#endif /* WIN32 / CYGWIN */
#endif /* _BITMAPINFOHEADER_HPP_ */
Now abc.cpp file is
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <memory>
#if defined(WIN32)
#include <Windows.h>
#endif
#include "TutException.hpp"
#include "TutFile.hpp"
#include "TutBitmap.hpp"
#include "TutLoadLibrary.hpp"
#include "TutParams.hpp"
#if defined(WIN32)
#define DERMALOG_LIBNAME "myDLL.dll" /* load the .dll file when using windows*/
#endif
#include "abc.h"
HMODULE g_hLib = NULL;
const char* (DRMAPI *GetErrorDescription)(DrmErrorCode_t nRetCode);
class SDK
{
public:
SDK() : fpInitialize(NULL), fpUninitialize(NULL)
{
GetFunction(g_hLib, "FC3Initialize", fpInitialize);
GetFunction(g_hLib, "FC3Uninitialize", fpUninitialize);
DrmErrorCode_t nRetCode = fpInitialize(NULL);
if (nRetCode!=FPC_SUCCESS)
throw Exception("Error (%d) while setting encoder callback: %s", (int)nRetCode, GetErrorDescription(nRetCode));
}
virtual ~SDK()
{
DrmErrorCode_t nRetCode = fpUninitialize();
if (nRetCode!=FPC_SUCCESS)
throw Exception("Error (%d) while setting encoder callback: %s", (int)nRetCode, GetErrorDescription(nRetCode));
}
public:
DrmErrorCode_t (DRMAPI *fpInitialize)(const char* szReserved);
DrmErrorCode_t (DRMAPI *fpUninitialize)(void);
};
Now I want to call FC3Initialize function in my maincpp.cpp file(how ?)