Share

Write your macro definition header file

Macro definitions for the project are kept in a separate file by convention. This file shares the same base name as the project source code file, but appended with Export. The macros defined in the file should share the same basename.

Every header that contains these macro definitions has the same format. Only the names of the definitions differs from one file to another.

This is what the SimpleStringExport.h example file contains:

#ifndef SIMPLE_STRING_EXPORT_H
#define SIMPLE_STRING_EXPORT_H

#if defined(_WIN32)
#define SIMPLE_STRING_EXPORT __declspec(dllexport)
#define SIMPLE_STRING_IMPORT __declspec(dllimport)
#elif defined(__GNUC__)
#define SIMPLE_STRING_EXPORT __attribute__((visibility("default")))
#define SIMPLE_STRING_IMPORT __attribute__((visibility("default")))
#else
#error Unsupported platform.
#endif

#if defined(SIMPLE_STRING_BUILD_NODEDEF_DLL)
#define SIMPLE_STRING_DECL SIMPLE_STRING_EXPORT
#else
#define SIMPLE_STRING_DECL SIMPLE_STRING_IMPORT
#endif

#endif

You can now move on to building your operators.

Was this information helpful?