
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Node Bindings for LLVM. The API is mostly identical to the one of LLVM (when possible and not to cumbersom). All supported methods with their signatures are listed in the TypeScript definition file.
Install the packages using npm or yarn.
npm install --save llvm-node
Require llvm-node and you're good to go
import * as llvm from "llvm-node";
// or
const llvm = require("llvm-node");
const context = new llvm.LLVMContext();
const module = new llvm.Module("test", context);
const intType = llvm.Type.getInt32Ty(context);
const initializer = llvm.ConstantInt.get(context, 0);
const globalVariable = new llvm.GlobalVariable(module, intType, true, llvm.LinkageTypes.InternalLinkage, initializer);
const ll = module.print(); // prints IR
llvm.writeBitcodeToFile(module, biteCodeFileName); // Writes file to disk
You can use the npm configuration options to set the path to the LLVM cmake directory. This is needed if you don't want to use the system default LLVM installation --- e.g. when you want to compile againt the latest dev version.
To change the LLVM version use:
npm config set cmake_LLVM_DIR $(path-to-llvm/bin/llvm-config --cmakedir)
If you want to change the value just for a single project use an .npmrc file in your project.
If you want to use Value.dump
or Module.dump
you need to use the debug build of the library (and, as well, of LLVM).
In this case, run node-gyp build --debug
or if using npm install
run npm_config_DEBUG=true npm install llvm-node
.
There variables can also be set using npm set:
npm config set [--global] DEBUG True
"cmake.configureSettings": {
"LLVM_DIR": "/usr/local/Cellar/llvm/7.0.0/lib/cmake/llvm" // Output of llvm-config --cmakedir
}
CMake:Configure
Command in Visual Studio Codeyarn configure
from the command lineCMake:Build
command in Visual Studio CodeFAQs
Node Bindings for LLVM >=4.0
We found that llvm-node demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.