diff options
author | Sverker Eriksson <[email protected]> | 2016-01-08 14:56:28 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2016-01-08 14:59:15 +0100 |
commit | b18d251931a43099cc18527bcf6898fff1b144f5 (patch) | |
tree | 9c09d2337349c06a1b0bfdd41eacb9123b9ef1fd | |
parent | 27cd49c16b442625782d68e6f802a1c76c48d349 (diff) | |
download | otp-b18d251931a43099cc18527bcf6898fff1b144f5.tar.gz otp-b18d251931a43099cc18527bcf6898fff1b144f5.tar.bz2 otp-b18d251931a43099cc18527bcf6898fff1b144f5.zip |
erts: Refactor ERL_NIF_INIT macro
-rw-r--r-- | erts/emulator/beam/erl_nif.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/erts/emulator/beam/erl_nif.h b/erts/emulator/beam/erl_nif.h index 1a21048ec9..6f1b7a7571 100644 --- a/erts/emulator/beam/erl_nif.h +++ b/erts/emulator/beam/erl_nif.h @@ -243,20 +243,20 @@ extern TWinDynNifCallbacks WinDynNifCallbacks; #if (defined(__WIN32__) || defined(_WIN32) || defined(_WIN32_)) # define ERL_NIF_INIT_GLOB TWinDynNifCallbacks WinDynNifCallbacks; -# ifdef STATIC_ERLANG_NIF -# define ERL_NIF_INIT_DECL(MODNAME) __declspec(dllexport) ErlNifEntry* MODNAME ## _nif_init(TWinDynNifCallbacks* callbacks) -# else -# define ERL_NIF_INIT_DECL(MODNAME) __declspec(dllexport) ErlNifEntry* nif_init(TWinDynNifCallbacks* callbacks) -# endif +# define ERL_NIF_INIT_ARGS TWinDynNifCallbacks* callbacks # define ERL_NIF_INIT_BODY memcpy(&WinDynNifCallbacks,callbacks,sizeof(TWinDynNifCallbacks)) +# define ERL_NIF_INIT_EXPORT __declspec(dllexport) #else # define ERL_NIF_INIT_GLOB +# define ERL_NIF_INIT_ARGS void # define ERL_NIF_INIT_BODY -# ifdef STATIC_ERLANG_NIF -# define ERL_NIF_INIT_DECL(MODNAME) ErlNifEntry* MODNAME ## _nif_init(void) -# else -# define ERL_NIF_INIT_DECL(MODNAME) ErlNifEntry* nif_init(void) -# endif +# define ERL_NIF_INIT_EXPORT +#endif + +#ifdef STATIC_ERLANG_NIF +# define ERL_NIF_INIT_DECL(MODNAME) ErlNifEntry* MODNAME ## _nif_init(ERL_NIF_INIT_ARGS) +#else +# define ERL_NIF_INIT_DECL(MODNAME) ERL_NIF_INIT_EXPORT ErlNifEntry* nif_init(ERL_NIF_INIT_ARGS) #endif #ifdef ERL_NIF_DIRTY_SCHEDULER_SUPPORT |