File tree Expand file tree Collapse file tree 4 files changed +21
-6
lines changed Expand file tree Collapse file tree 4 files changed +21
-6
lines changed Original file line number Diff line number Diff line change 1+ #ifndef INIT_SSH2
2+ #define INIT_SSH2
3+
4+ void init_ssh2 ();
5+
6+ #endif
Original file line number Diff line number Diff line change 1+ // We are initializing libssh2 from a separate .cc file to avoid ssize_t
2+ // redefinition conflicts caused by incliding both node.h and libssh2.h from
3+ // the same file (e.g. nodegit.cc)
4+ //
5+ // The redefinition can also be avoided by #defines but that is risky in case
6+ // the libraries depend on the different definitions.
7+
8+ #include < libssh2.h>
9+
10+ void init_ssh2 () {
11+ libssh2_init (0 );
12+ }
Original file line number Diff line number Diff line change 1616 "sources" : [
1717 "src/lock_master.cc" ,
1818 "src/nodegit.cc" ,
19+ "src/init_ssh2.cc" ,
1920 "src/promise_completion.cc" ,
2021 "src/wrapper.cc" ,
2122 "src/functions/copy.cc" ,
Original file line number Diff line number Diff line change 88#include < set>
99
1010#include < openssl/crypto.h>
11- // we have to include <libssh2.h> first so it defines ssize_t
12- // and then node.h with _SSIZE_T_ defined to prevent it from redefining
13- // in a conflicting way on 32 bit windows
14- #define ssize_t ssize_t
15- #include < libssh2.h>
1611
12+ #include " ../include/init_ssh2.h"
1713#include " ../include/lock_master.h"
1814#include " ../include/wrapper.h"
1915#include " ../include/promise_completion.h"
@@ -75,7 +71,7 @@ void OpenSSL_ThreadSetup() {
7571extern " C" void init (Local<v8::Object> target) {
7672 // Initialize thread safety in openssl and libssh2
7773 OpenSSL_ThreadSetup ();
78- libssh2_init ( 0 );
74+ init_ssh2 ( );
7975 // Initialize libgit2.
8076 git_libgit2_init ();
8177
You can’t perform that action at this time.
0 commit comments