diff --git a/src/discord-rpc-simple.cpp b/src/discord-rpc-simple.cpp index ad72db0..8aa9669 100644 --- a/src/discord-rpc-simple.cpp +++ b/src/discord-rpc-simple.cpp @@ -257,7 +257,7 @@ void ConnectionWrite(const void* data, size_t length) } // anonymous namespace -void Discord_Initialize(const char* applicationId, DiscordEventHandlers* handlers) +extern "C" void Discord_Initialize(const char* applicationId, DiscordEventHandlers* handlers) { StringCopy(ApplicationId, applicationId, sizeof(ApplicationId)); if (handlers) { @@ -270,13 +270,13 @@ void Discord_Initialize(const char* applicationId, DiscordEventHandlers* handler ConnectionOpen(); } -void Discord_Shutdown() +extern "C" void Discord_Shutdown() { Handlers = {}; ConnectionClose(); } -void Discord_UpdatePresence(const DiscordRichPresence* presence) +extern "C" void Discord_UpdatePresence(const DiscordRichPresence* presence) { char* jsonWrite = Frame.message; diff --git a/src/discord-rpc.cpp b/src/discord-rpc.cpp index 32c47fa..97a12b0 100644 --- a/src/discord-rpc.cpp +++ b/src/discord-rpc.cpp @@ -9,7 +9,7 @@ static DiscordEventHandlers Handlers{}; static bool wasJustConnected = false; static bool wasJustDisconnected = false; -void Discord_Initialize(const char* applicationId, DiscordEventHandlers* handlers) +extern "C" void Discord_Initialize(const char* applicationId, DiscordEventHandlers* handlers) { StringCopy(ApplicationId, applicationId, sizeof(ApplicationId)); if (handlers) { @@ -25,14 +25,14 @@ void Discord_Initialize(const char* applicationId, DiscordEventHandlers* handler MyConnection->Open(); } -void Discord_Shutdown() +extern "C" void Discord_Shutdown() { Handlers = {}; MyConnection->Close(); RpcConnection::Destroy(MyConnection); } -void Discord_UpdatePresence(const DiscordRichPresence* presence) +extern "C" void Discord_UpdatePresence(const DiscordRichPresence* presence) { auto frame = MyConnection->GetNextFrame(); char* jsonWrite = frame->message; @@ -41,7 +41,7 @@ void Discord_UpdatePresence(const DiscordRichPresence* presence) MyConnection->WriteFrame(frame); } -void Discord_Update() +extern "C" void Discord_Update() { // check for messages // todo