• Что бы вступить в ряды "Принятый кодер" Вам нужно:
    Написать 10 полезных сообщений или тем и Получить 10 симпатий.
    Для того кто не хочет терять время,может пожертвовать средства для поддержки сервеса, и вступить в ряды VIP на месяц, дополнительная информация в лс.

  • Пользаватели которые будут спамить, уходят в бан без предупреждения. Спам сообщения определяется администрацией и модератором.

  • Гость, Что бы Вы хотели увидеть на нашем Форуме? Изложить свои идеи и пожелания по улучшению форума Вы можете поделиться с нами здесь. ----> Перейдите сюда
  • Все пользователи не прошедшие проверку электронной почты будут заблокированы. Все вопросы с разблокировкой обращайтесь по адресу электронной почте : info@guardianelinks.com . Не пришло сообщение о проверке или о сбросе также сообщите нам.

New shared objects linker on JavaScript nodejs u all waiting for!!!

Lomanu4 Оффлайн

Lomanu4

Команда форума
Администратор
Регистрация
1 Мар 2015
Сообщения
1,481
Баллы
155
solijs


solijs is an npm package that allows you to dynamically link and execute functions from shared object (.so) files directly within your JavaScript projects. It provides a fast, simple, and efficient way to call C/C++ functions without the need for complex build tools like node-gyp.

Features

  • No Complex Build Tools: Link .so files to your Node.js project without needing node-gyp, ffi, or other build tools.
  • Cross-Platform Support: Works on Linux, macOS, and Windows.
  • Easy to Use API: Call C/C++ functions from .so files with minimal code.
  • Fast Execution: Optimized for performance and minimal overhead.
Installation


To install solijs, use npm or yarn:


npm install solijs

or


yarn add solijs
Usage

1. Create a .so File (e.g., libhello.so)


First, create a shared object file (.so). For example, write a simple C function that returns a value:


// hello.c
#include <stdio.h>

int give_number() {
return 3 + 2;
}

Compile it into a .so file:


gcc -shared -o libhello.so -fPIC hello.c
2. Create a JavaScript File to Call the Function


Now, use solijs to call the function inside the .so file. Here's an example:


const solijs = require('solijs');
const path = require('path');

const soPath = path.join(__dirname, 'libhello.so');
const symbol = 'give_number'; // The function name in the .so file

solijs.runValue(soPath, symbol)
.then(result => {
console.log('Result from .so:', result);
})
.catch(err => {
console.error('Error:', err);
});
API Reference

runText(soPath, symbol)


This method runs a function from the .so file that doesn't return a value but outputs text to the console.

  • soPath (string): Path to the .so file.
  • symbol (string): The name of the function to execute.
runValue(soPath, symbol)


This method executes a function from the .so file that returns an integer value.

  • soPath (string): Path to the .so file.
  • symbol (string): The name of the function to execute.
inspect(soPath)


This method retrieves the list of symbols available in the .so file.

  • soPath (string): Path to the .so file.
Example Project


You can check out a sample project with the usage examples and the .so files in the GitHub repository:


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



Why You Should Try solijs


If you're looking for a fast and easy way to integrate C/C++ code with JavaScript, solijs is a game-changer. It eliminates the need for complex build processes and gives you the flexibility to use native code directly from your JavaScript environment. Plus, it's optimized for performance, making it ideal for performance-critical applications.

License


MIT

link:

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.




Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

 
Вверх Снизу