CFx SDK Documentation  2022 SP0
FxInit.h
Go to the documentation of this file.
1 //
2 // (C) Copyright 2005-2021 by Graebert GmbH.
3 //
4 // Permission to use, copy, modify, and distribute this software in
5 // object code form for any purpose and without fee is hereby granted,
6 // provided that the above copyright notice appears in all copies and
7 // that both that copyright notice and the limited warranty and
8 // restricted rights notice below appear in all supporting
9 // documentation.
10 //
11 // GRAEBERT PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
12 // GRAEBERT SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
13 // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. GRAEBERT GMBH
14 // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
15 // UNINTERRUPTED OR ERROR FREE.
16 
17 #pragma once
18 
19 #include <RxDynamicModule.h>
20 
21 #include "FxString.h"
22 #include "FxSystemServices.h"
23 
32 #define FX_DEFINE_DYNAMIC_MODULE(_UserModuleClass, _Application) \
33  static OdRxModule* g_pSingletonModule = 0; \
34  extern "C" { \
35  __declspec(dllexport) OdRxModule* odrxCreateModuleObject(HMODULE& hModule) \
36  { \
37  if(!g_pSingletonModule) \
38  { \
39  CFxString sProgramName = GetFxSystemServices()->GetHostAppServices()->program(); \
40  if( sProgramName.equalNoCase( CFxString::from_ansi_str( _Application ) ) ) \
41  { \
42  g_pSingletonModule = OdRxWin32Module<_UserModuleClass >::createModule(hModule); \
43  } \
44  hModule = 0; \
45  } \
46  return g_pSingletonModule; \
47  } \
48  __declspec(dllexport) void odrxGetAPIVersion(int& nMajorVersion, int& nMinorVersion, \
49  int& nMajorBuildVersion, int& nMinorBuildVersion) \
50  { \
51  nMajorVersion = TD_MAJOR_VERSION; \
52  nMinorVersion = TD_MINOR_VERSION; \
53  nMajorBuildVersion = TD_MAJOR_BUILD; \
54  nMinorBuildVersion = TD_MINOR_BUILD; \
55  } \
56  }