Skip to content

JS module for alt:V Multiplayer. Powered by NodeJS & v8

License

Notifications You must be signed in to change notification settings

Serrulien/altv-js-module

 
 

Repository files navigation

altv-js-module

JS module for alt:V Multiplayer. Powered by NodeJS & v8

Troubleshooting

Problem: I want to build a native Node.js addon with node-gyp but the alt:V server can not load it and responds with following error:

./altv-server: symbol lookup error: /usr/share/addon/binding.node: undefined symbol: node_module_register

Solution: Add a C++ file to your project with following content and include it the sources in your binding.gyp file.

#include <node.h>
#include <dlfcn.h>

extern "C" NODE_EXTERN void node_module_register(void* mod) {
  auto base_ptr = dlopen("libnode.so.72", RTLD_NOW | RTLD_GLOBAL);
  if (base_ptr == nullptr) {
    return;
  }
  auto register_func = reinterpret_cast<decltype(&node_module_register)>(dlsym(base_ptr, "node_module_register"));
  if (register_func == nullptr) {
    return;
  }
  register_func(mod);
}

About

JS module for alt:V Multiplayer. Powered by NodeJS & v8

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 91.6%
  • JavaScript 6.0%
  • CMake 2.0%
  • Other 0.4%