-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding the waku_addon.c code that allows the use of NimWaku in NodeJs
Notice that it is not yet fully operative because there are issues between the NodeJs GC and the Nim's GC, i.e. memory allocated by the Nim's GC is freed by the NodeJs GC producing a crash.
- Loading branch information
1 parent
59a5c3c
commit 80a9fa9
Showing
6 changed files
with
1,218 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"targets": [ | ||
{ | ||
"target_name": "waku", | ||
"sources": [ "waku_addon.c" ], | ||
"libraries": [ "-lwaku", "-L../../../build/" ] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* Generated by Nim Compiler v1.6.11 */ | ||
#ifndef __libwaku__ | ||
#define __libwaku__ | ||
#define NIM_INTBITS 64 | ||
|
||
#include "nimbase.h" | ||
#undef LANGUAGE_C | ||
#undef MIPSEB | ||
#undef MIPSEL | ||
#undef PPC | ||
#undef R3000 | ||
#undef R4000 | ||
#undef i386 | ||
#undef linux | ||
#undef mips | ||
#undef near | ||
#undef far | ||
#undef powerpc | ||
#undef unix | ||
typedef struct ConfigNode ConfigNode; | ||
typedef struct NimStringDesc NimStringDesc; | ||
typedef struct TGenericSeq TGenericSeq; | ||
struct TGenericSeq {NI len; | ||
NI reserved; | ||
}; | ||
struct NimStringDesc { TGenericSeq Sup;NIM_CHAR data[SEQ_DECL_SIZE]; | ||
}; | ||
typedef N_CDECL_PTR(void, tyProc__5cp59bim9aJ4WupX5aVaD1Sg) (NCSTRING signal_0); | ||
N_LIB_PRIVATE N_NOCONV(void, signalHandler)(int sign); | ||
N_LIB_PRIVATE N_NIMCALL(NI, getRefcount)(void* p); | ||
N_LIB_IMPORT N_CDECL(NIM_BOOL, waku_new)(ConfigNode* config, NimStringDesc** jsonResp); | ||
N_LIB_IMPORT N_CDECL(NCSTRING, waku_version)(void); | ||
N_LIB_IMPORT N_CDECL(void, waku_set_event_callback)(tyProc__5cp59bim9aJ4WupX5aVaD1Sg callback); | ||
N_LIB_IMPORT N_CDECL(void, waku_content_topic)(NCSTRING appName, NU appVersion, NCSTRING contentTopicName, NCSTRING encoding, NimStringDesc** outContentTopic); | ||
N_LIB_IMPORT N_CDECL(void, waku_pubsub_topic)(NCSTRING topicName, NimStringDesc** outPubsubTopic); | ||
N_LIB_IMPORT N_CDECL(void, waku_default_pubsub_topic)(NimStringDesc** defPubsubTopic); | ||
N_LIB_IMPORT N_CDECL(NIM_BOOL, waku_relay_publish)(NCSTRING pubSubTopic, NCSTRING jsonWakuMessage, NI timeoutMs, NimStringDesc** jsonResp); | ||
N_LIB_IMPORT N_CDECL(void, waku_start)(void); | ||
N_LIB_IMPORT N_CDECL(void, waku_stop)(void); | ||
N_LIB_IMPORT N_CDECL(NIM_BOOL, waku_relay_subscribe)(NCSTRING pubSubTopic, NimStringDesc** jsonResp); | ||
N_LIB_IMPORT N_CDECL(NIM_BOOL, waku_relay_unsubscribe)(NCSTRING pubSubTopic, NimStringDesc** jsonResp); | ||
N_LIB_IMPORT N_CDECL(NIM_BOOL, waku_connect)(NCSTRING peerMultiAddr, NU timeoutMs, NimStringDesc** jsonResp); | ||
N_LIB_IMPORT N_CDECL(void, waku_poll)(void); | ||
N_LIB_IMPORT N_CDECL(void, NimMain)(void); | ||
#endif /* __libwaku__ */ |
Oops, something went wrong.