Skip to content
Snippets Groups Projects
Commit 9cc1a9a6 authored by Richard T. Carback III's avatar Richard T. Carback III
Browse files

Merge branch 'hotfix/declspec' into 'main'

Fix Windows DLL

See merge request !3
parents d337c72c f1ee3721
No related branches found
No related tags found
1 merge request!3Fix Windows DLL
DOTNET = xxdk.NET DOTNET = xxdk.NET
.PHONY: all windows-x64 windows-arm64 linux-arm64 linux-arm64 darwin-x64 darwin-arm64 dotnet .PHONY: all windows-x64 windows-arm64 linux-x64 linux-arm64 darwin-x64 darwin-arm64 dotnet
libxxdk-win-x64.dll: libxxdk-win-x64.dll:
CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -buildmode=c-shared -o $@ ./sharedcgo CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -buildmode=c-shared -o $@ ./sharedcgo
......
...@@ -9,11 +9,30 @@ x86_64). It should run on Windows but may need the library name ...@@ -9,11 +9,30 @@ x86_64). It should run on Windows but may need the library name
changed. changed.
``` ```
make -k make linux-x64
cd xxdk.NET cd xxdk.NET
dotnet run --ndf mainnet-ndf.json --state-dir world --wait 20 | grep ^DM dotnet run --ndf mainnet-ndf.json --state-dir world --wait 20 | grep ^DM
``` ```
Usually, you will want to make the library only for your
architecture. The options are:
* windows-x64
* windows-arm64
* linux-x64
* linux-arm64
* darwin-x64
* darwin-arm64
NOTE: you may need to specify a compiler to the make command, especially
when cross compiling. Example for compiling to windows:
```
CC=x86_64-w64-mingw32-gcc make windows-x64
cd xxdk.NET
dotnet run --ndf mainnet-ndf.json --state-dir world --wait 20 | grep ^DM
```
It's highly recommended to run with grep on the output. Especially on It's highly recommended to run with grep on the output. Especially on
mainnet, logs can be noisy with failure to connect errors as it accesses mainnet, logs can be noisy with failure to connect errors as it accesses
the network. the network.
......
...@@ -21,7 +21,7 @@ package main ...@@ -21,7 +21,7 @@ package main
// // here because of cgo rules. // // // here because of cgo rules. //
// ///////////////////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////////////////
// //
// long cmix_dm_receive(int dm_instance_id, // DLL_EXPORT long cmix_dm_receive(int dm_instance_id,
// void* message_id, int message_id_len, // void* message_id, int message_id_len,
// char* nickname, int nickname_len, // char* nickname, int nickname_len,
// void* text, int text_len, // void* text, int text_len,
...@@ -34,7 +34,7 @@ package main ...@@ -34,7 +34,7 @@ package main
// text, text_len, partnerkey, partnerkey_len, senderkey, senderkey_len, // text, text_len, partnerkey, partnerkey_len, senderkey, senderkey_len,
// dmToken, codeset, timestamp, round_id, msg_type, status); // dmToken, codeset, timestamp, round_id, msg_type, status);
// } // }
// long cmix_dm_receive_text(int dm_instance_id, // DLL_EXPORT long cmix_dm_receive_text(int dm_instance_id,
// void* message_id, int message_id_len, // void* message_id, int message_id_len,
// char* nickname, int nickname_len, // char* nickname, int nickname_len,
// char* text, int text_len, // char* text, int text_len,
...@@ -47,7 +47,7 @@ package main ...@@ -47,7 +47,7 @@ package main
// text, text_len, partnerkey, partnerkey_len, senderkey, senderkey_len, // text, text_len, partnerkey, partnerkey_len, senderkey, senderkey_len,
// dmToken, codeset, timestamp, round_id, status); // dmToken, codeset, timestamp, round_id, status);
// } // }
// long cmix_dm_receive_reply(int dm_instance_id, // DLL_EXPORT long cmix_dm_receive_reply(int dm_instance_id,
// void* message_id, int message_id_len, // void* message_id, int message_id_len,
// void* reply_to, int reply_to_len, // void* reply_to, int reply_to_len,
// char* nickname, int nickname_len, // char* nickname, int nickname_len,
...@@ -62,7 +62,7 @@ package main ...@@ -62,7 +62,7 @@ package main
// text, text_len, partnerkey, partnerkey_len, senderkey, senderkey_len, // text, text_len, partnerkey, partnerkey_len, senderkey, senderkey_len,
// dmToken, codeset, timestamp, round_id, status); // dmToken, codeset, timestamp, round_id, status);
// } // }
// long cmix_dm_receive_reaction(int dm_instance_id, // DLL_EXPORT long cmix_dm_receive_reaction(int dm_instance_id,
// void* message_id, int message_id_len, // void* message_id, int message_id_len,
// void* reaction_to, int reaction_to_len, // void* reaction_to, int reaction_to_len,
// char* nickname, int nickname_len, // char* nickname, int nickname_len,
...@@ -77,17 +77,17 @@ package main ...@@ -77,17 +77,17 @@ package main
// text, text_len, partnerkey, partnerkey_len, senderkey, senderkey_len, // text, text_len, partnerkey, partnerkey_len, senderkey, senderkey_len,
// dmToken, codeset, timestamp, round_id, status); // dmToken, codeset, timestamp, round_id, status);
// } // }
// void cmix_dm_update_sent_status(int dm_instance_id, // DLL_EXPORT void cmix_dm_update_sent_status(int dm_instance_id,
// long uuid, // long uuid,
// void* message_id, int message_id_len, long timestamp, // void* message_id, int message_id_len, long timestamp,
// long round_id, long status) { // long round_id, long status) {
// DMReceiverRouter.updateSentStatusFn(dm_instance_id, uuid, // DMReceiverRouter.updateSentStatusFn(dm_instance_id, uuid,
// message_id, message_id_len, timestamp, round_id, status); // message_id, message_id_len, timestamp, round_id, status);
// } // }
// void cmix_dm_block_sender(int dm_instance_id, void* pubkey, int pubkey_len) { // DLL_EXPORT void cmix_dm_block_sender(int dm_instance_id, void* pubkey, int pubkey_len) {
// DMReceiverRouter.blockSenderFn(dm_instance_id, pubkey, pubkey_len); // DMReceiverRouter.blockSenderFn(dm_instance_id, pubkey, pubkey_len);
// } // }
// void cmix_dm_unblock_sender(int dm_instance_id, void* pubkey, // DLL_EXPORT void cmix_dm_unblock_sender(int dm_instance_id, void* pubkey,
// int pubkey_len) { // int pubkey_len) {
// DMReceiverRouter.unblockSenderFn(dm_instance_id, pubkey, pubkey_len); // DMReceiverRouter.unblockSenderFn(dm_instance_id, pubkey, pubkey_len);
// } // }
...@@ -99,7 +99,7 @@ package main ...@@ -99,7 +99,7 @@ package main
// GoByteSlice cmix_dm_get_conversations(int dm_instance_id) { // GoByteSlice cmix_dm_get_conversations(int dm_instance_id) {
// return DMReceiverRouter.getConversationsFn(dm_instance_id); // return DMReceiverRouter.getConversationsFn(dm_instance_id);
// } // }
// extern void cmix_dm_set_router(DMReceiverRouterFunctions cbs) { // DLL_EXPORT void cmix_dm_set_router(DMReceiverRouterFunctions cbs) {
// DMReceiverRouter.receiveFn = cbs.receiveFn; // DMReceiverRouter.receiveFn = cbs.receiveFn;
// DMReceiverRouter.receiveTextFn = cbs.receiveTextFn; // DMReceiverRouter.receiveTextFn = cbs.receiveTextFn;
// DMReceiverRouter.receiveReplyFn = cbs.receiveReplyFn; // DMReceiverRouter.receiveReplyFn = cbs.receiveReplyFn;
......
...@@ -72,5 +72,10 @@ typedef struct { ...@@ -72,5 +72,10 @@ typedef struct {
cmix_dm_get_conversations_fn getConversationsFn; cmix_dm_get_conversations_fn getConversationsFn;
} DMReceiverRouterFunctions; } DMReceiverRouterFunctions;
#ifdef _WIN32
#define DLL_EXPORT __declspec(dllexport)
#else
#define DLL_EXPORT
#endif
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment