Skip to content
 
 

Repository files navigation

@napi-ffi/get-symbol-from-current-process-h

CI npm version npm downloads License: ISC

Cross-platform C function to get a symbol from the current process

This package provides a header-only C library for retrieving symbols from the current process in a cross-platform manner. It works on Unix-like systems (using dlsym) and Windows (using GetProcAddress).

Originally authored by Anna Henningsen as part of the node-ffi-napi project. This is a maintained fork under the @napi-ffi organization.

Installation

Install with npm:

npm install @napi-ffi/get-symbol-from-current-process-h

Usage

In your binding.gyp:

'include_dirs': [
  "<!@(node -p \"require('@napi-ffi/get-symbol-from-current-process-h').include\")"
]

In your C/C++ code:

#include <get-symbol-from-current-process.h>

void* sym = get_symbol_from_current_process("my_function");
if (sym != NULL) {
  // Use the symbol
}

API

void* get_symbol_from_current_process(const char* name)

Retrieves a symbol from the current process by name.

Parameters:

  • name: The name of the symbol to retrieve (must not be NULL)

Returns:

  • Pointer to the symbol if found
  • NULL if the symbol is not found or an error occurs

This package requires Node.js >= 20.0.0

License

ISC License - See LICENSE file for details

About

C function to get a symbol from the current process

Resources

Code of conduct

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages