Java Code Examples for org.bridj.Pointer#get()

The following examples show how to use org.bridj.Pointer#get() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExecutionEngine.java    From llvm-j with MIT License 5 votes vote down vote up
public static ExecutionEngine createForModule(Module m) {
    Pointer<Pointer<Byte>> outError = Pointer.allocateBytes(1, 1024);

    Pointer<LLVMExecutionEngineRef> pEE = Pointer
            .allocateTypedPointer(LLVMExecutionEngineRef.class);

    boolean err = LLVMCreateExecutionEngineForModule(pEE, m.module(),
            outError) != 0;
    if (err) {
        String msg = outError.get().getCString();
        throw new RuntimeException("can't create execution engine: " + msg);
    }

    return new ExecutionEngine(pEE.get());
}
 
Example 2
Source File: ExecutionEngine.java    From llvm-j with MIT License 5 votes vote down vote up
public Module removeModule(Module m) {
    Pointer<Pointer<Byte>> outError = Pointer.allocateBytes(1, 1024);
    Pointer<LLVMModuleRef> outMod = Pointer
            .allocateTypedPointer(LLVMModuleRef.class);
    boolean err = LLVMRemoveModule(engine, m.module(), outMod, outError) != 0;
    if (err) {
        String msg = outError.get().getCString();
        throw new RuntimeException("can't remove module: " + msg);
    }
    return new Module(outMod.get());
}
 
Example 3
Source File: ExecutionEngine.java    From llvm-j with MIT License 5 votes vote down vote up
public Module removeModuleProvider(LLVMModuleProviderRef mp) {
    Pointer<Pointer<Byte>> outError = Pointer.allocateBytes(1, 1024);
    Pointer<LLVMModuleRef> outMod = Pointer
            .allocateTypedPointer(LLVMModuleRef.class);
    boolean err = LLVMRemoveModuleProvider(engine, mp, outMod, outError) != 0;
    if (err) {
        String msg = outError.get().getCString();
        throw new RuntimeException("can't remove module provider: " + msg);
    }
    return new Module(outMod.get());
}
 
Example 4
Source File: ExecutionEngine.java    From llvm-j with MIT License 5 votes vote down vote up
public Value findFunction(String name) { // Pointer<Pointer<LLVMOpaqueValue>> outFn) {
    Pointer<Byte> cstr = Pointer.pointerToCString(name);
    Pointer<LLVMValueRef> outFn = Pointer
            .allocateTypedPointer(LLVMValueRef.class);
    boolean err = LLVMFindFunction(engine, cstr, outFn) != 0;
    if (err) {
        throw new RuntimeException("LLVMFindFunction can't find " + name);
    }
    return new Value(outFn.get());
}