Tags

,

A link on dll - http://www.codeproject.com/KB/DLL/XDllPt4.aspx

implicit loading - requires the .lib
explicit loading - need code, i.e. LoadLibrary/GetProcAddress etc

#ifndef SAMPL_DLL_API_HEADER //prevent multi includes
#define SAMPL_DLL_API_HEADER

// The following ifdef block is the standard way of creating macros
// which make exporting from a DLL simpler. All files within this DLL
// are compiled with the SAMPLE_DLL_EXPORTS symbol defined on the command line.
// This symbol should not be defined on any project that uses this DLL.
// This way any other project whose source files include this file see 
// TEST_API functions as being imported from a DLL, whereas this DLL
// sees symbols defined with this macro as being exported.

// Instead of defining SAMPLE_DLL_EXPORTS in command line, the other optino
// is to define it in the code as:
// #define SAMPLE_DLL_EXPORTS

#ifdef SAMPLE_DLL_EXPORTS
#define SAMPLE_DLL_API __declspec(dllexport)
#else
#define SAMPLE_DLL_API __declspec(dllimport)
#endif


#ifdef __cplusplus // if a cpp compiler
extern "C" {
#endif


#ifdef __cplusplus
}
#endif

#endif //SAMPL_DLL_API_HEADER

Advertisements