Skip to content

Commit 69f8244

Browse files
committed
Add NETLEAF_API Macro.
1 parent 88d6fb4 commit 69f8244

File tree

5 files changed

+18
-19
lines changed

5 files changed

+18
-19
lines changed

NetLeaf/DotNetBackend.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,10 @@
66
#include <coreclr_delegates.h>
77
#include <hostfxr.h>
88

9-
#ifdef DOTNETBACKEND_EXPORTS
10-
#define DOTNETBACKEND_API __declspec(dllexport)
11-
#else
12-
#define DOTNETBACKEND_API __declspec(dllimport)
13-
#endif
14-
9+
#include "NetLeafAPI.h"
1510
#include "ICSharpBackend.h"
1611

17-
class DOTNETBACKEND_API DotNetBackend : public ICSharpBackend
12+
class NETLEAF_API DotNetBackend : public ICSharpBackend
1813
{
1914
private:
2015
// HostFxr function pointers

NetLeaf/NetLeaf.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@
33
#include <vector>
44
#include "ICSharpBackend.h"
55
#include "NetLeafInstance.h"
6-
7-
#ifdef NETLEAF_EXPORTS
8-
#define NETLEAF_API __declspec(dllexport) // Export for DLL
9-
#else
10-
#define NETLEAF_API __declspec(dllimport) // Import for users of the DLL
11-
#endif
6+
#include "NetLeafAPI.h"
127

138
class NETLEAF_API NetLeaf
149
{

NetLeaf/NetLeafAPI.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#pragma once
2+
3+
#if defined(_WIN32)
4+
5+
#if defined(NETLEAF_BUILD)
6+
#define NETLEAF_API __declspec(dllexport)
7+
#else
8+
#define NETLEAF_API __declspec(dllimport)
9+
#endif
10+
11+
#else
12+
#define NETLEAF_API __attribute__((visibility("default")))
13+
#endif

NetLeaf/NetLeafInstance.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
#pragma once
22
#include "CSharpInterop.h"
3-
4-
#ifdef NETLEAF_EXPORTS
5-
#define NETLEAF_API __declspec(dllexport) // Export for DLL
6-
#else
7-
#define NETLEAF_API __declspec(dllimport) // Import for users of the DLL
8-
#endif
3+
#include "NetLeafAPI.h"
94

105
class NETLEAF_API NetLeafInstance
116
{

premake5.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ workspace "NetLeafWorkspace"
66
-- C++ project (NetLeaf)
77
project "NetLeaf"
88
kind "SharedLib"
9+
defines {"NETLEAF_BUILD"}
910
language "C++"
1011
location "NetLeaf"
1112
targetdir ("%{wks.location}/build/lib")

0 commit comments

Comments
 (0)