Browse Source

Support native extension loading on Windows

v0.7.4-release
Bert Belder 13 years ago
parent
commit
4a1efb2b9c
  1. 2
      common.gypi
  2. 31
      src/node.h

2
common.gypi

@ -106,6 +106,8 @@
# ... or that C implementations shouldn't use # ... or that C implementations shouldn't use
# POSIX names # POSIX names
'_CRT_NONSTDC_NO_DEPRECATE', '_CRT_NONSTDC_NO_DEPRECATE',
'BUILDING_V8_SHARED=1',
'BUILDING_UV_SHARED=1',
], ],
}], }],
[ 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', { [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', {

31
src/node.h

@ -22,6 +22,23 @@
#ifndef SRC_NODE_H_ #ifndef SRC_NODE_H_
#define SRC_NODE_H_ #define SRC_NODE_H_
#ifdef _WIN32
# ifndef BUILDING_NODE_EXTENSION
# define NODE_EXTERN __declspec(dllexport)
# else
# define NODE_EXTERN __declspec(dllimport)
# endif
#else
# define NODE_EXTERN /* nothing */
#endif
#ifdef BUILDING_NODE_EXTENSION
# undef BUILDING_V8_SHARED
# undef BUILDING_UV_SHARED
# define USING_V8_SHARED 1
# define USING_UV_SHARED 1
#endif
// This should be defined in make system. // This should be defined in make system.
// See issue https://github.com/joyent/node/issues/1236 // See issue https://github.com/joyent/node/issues/1236
#if defined(__MINGW32__) || defined(_MSC_VER) #if defined(__MINGW32__) || defined(_MSC_VER)
@ -196,16 +213,24 @@ node_module_struct* get_builtin_module(const char *name);
NULL, \ NULL, \
__FILE__ __FILE__
#ifdef _WIN32
# define NODE_MODULE_EXPORT __declspec(dllexport)
#else
# define NODE_MODULE_EXPORT /* empty */
#endif
#define NODE_MODULE(modname, regfunc) \ #define NODE_MODULE(modname, regfunc) \
node::node_module_struct modname ## _module = \ extern "C" { \
NODE_MODULE_EXPORT node::node_module_struct modname ## _module = \
{ \ { \
NODE_STANDARD_MODULE_STUFF, \ NODE_STANDARD_MODULE_STUFF, \
regfunc, \ regfunc, \
NODE_STRINGIFY(modname) \ NODE_STRINGIFY(modname) \
}; }; \
}
#define NODE_MODULE_DECL(modname) \ #define NODE_MODULE_DECL(modname) \
extern node::node_module_struct modname ## _module; extern "C" node::node_module_struct modname ## _module;
void SetErrno(uv_err_t err); void SetErrno(uv_err_t err);
void MakeCallback(v8::Handle<v8::Object> object, void MakeCallback(v8::Handle<v8::Object> object,

Loading…
Cancel
Save