NAP
utility/src/utility/module.h
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4 
5 #pragma once
6 
7 #include "dllexport.h"
8 
9 namespace nap
10 {
11  inline constexpr int moduleAPIVersion = 1;
12 
18  {
19  int mAPIVersion; // The version of the module API this module was built against. Must be the first member.
20  const char* mID; // The ID (name) of the module
21  const char* mVersion; // The version of the module
22  const char* mService; // The service associated with the module
23  };
24 
28  #define NAP_MODULE(moduleID, moduleVersion) \
29  extern "C" \
30  { \
31  NAPAPI nap::ModuleDescriptor descriptor = \
32  { \
33  nap::moduleAPIVersion, \
34  moduleID, \
35  moduleVersion, \
36  nullptr \
37  }; \
38  }
39 
43  #define NAP_SERVICE_MODULE(moduleID, moduleVersion, moduleService) \
44  extern "C" \
45  { \
46  NAPAPI nap::ModuleDescriptor descriptor = \
47  { \
48  nap::moduleAPIVersion, \
49  moduleID, \
50  moduleVersion, \
51  moduleService \
52  }; \
53  }
54 }
nap::ModuleDescriptor::mAPIVersion
int mAPIVersion
Definition: utility/src/utility/module.h:19
nap::ModuleDescriptor::mID
const char * mID
Definition: utility/src/utility/module.h:20
nap::ModuleDescriptor
Definition: utility/src/utility/module.h:17
nap::ModuleDescriptor::mVersion
const char * mVersion
Definition: utility/src/utility/module.h:21
nap::moduleAPIVersion
constexpr int moduleAPIVersion
Current module API version.
Definition: utility/src/utility/module.h:11
nap::ModuleDescriptor::mService
const char * mService
Definition: utility/src/utility/module.h:22
nap
Definition: templateapp.h:17