Package org.jruby.ext.ffi

Examples of org.jruby.ext.ffi.DirectMemoryIO


            if (!(type instanceof Type)) {
                throw context.getRuntime().newArgumentError("Invalid parameter type");
            }
            parameterTypes[i] = (Type) paramTypes.entry(i);
        }
        DirectMemoryIO fptr = (DirectMemoryIO) ptr.getMemoryIO();
        return new JFFIInvoker(context.getRuntime(), (RubyClass) recv, fptr,
                (Type) returnType, parameterTypes,
                "stdcall".equals(convention) ? CallingConvention.STDCALL : CallingConvention.DEFAULT,
                enums);
    }
View Full Code Here


        getSingletonClass().addMethod("call", createDynamicMethod(getSingletonClass()));
    }
   
    @JRubyMethod(name = { "new" }, meta = true, required = 2, optional = 2)
    public static IRubyObject newInstance(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) {
        DirectMemoryIO fptr = null;
        RubyHash options = null;
        Object proc = null;
        int optionsIndex = 2;

        Type returnType = FFIUtil.resolveType(context, args[0]);
View Full Code Here

                : runtime.getNil();

        } else if (type instanceof StructByValue) {
            StructByValue sbv = (StructByValue) type;
            final long address = buffer.getStruct(index);
            DirectMemoryIO memory = address != 0
                    ? new BoundedNativeMemoryIO(runtime, address, type.getNativeSize())
                    : new NullMemoryIO(runtime);

            return sbv.getStructClass().newInstance(runtime.getCurrentContext(),
                        new IRubyObject[] { new Pointer(runtime, memory) },
View Full Code Here

            }
        }

        ByteList bl = s.getByteList();
        StringSupport.checkStringSafety(s.getRuntime(), s);
        DirectMemoryIO memory = TransientNativeMemoryIO.allocateAligned(s.getRuntime(), bl.length() + 1, 1, false);
        memory.putZeroTerminatedByteArray(0, bl.getUnsafeBytes(), bl.begin(), bl.length());
        s.setByteListShared();
        s.setFFIHandle(new NativeStringHandle(memory, s.getByteList()));

        return memory.getAddress();
    }
View Full Code Here

            if (!(type instanceof Type)) {
                throw context.runtime.newArgumentError("Invalid parameter type");
            }
            parameterTypes[i] = (Type) paramTypes.entry(i);
        }
        DirectMemoryIO fptr = (DirectMemoryIO) ptr.getMemoryIO();
        return new JFFIInvoker(context.runtime, (RubyClass) recv, fptr,
                (Type) returnType, parameterTypes,
                "stdcall".equals(convention) ? CallingConvention.STDCALL : CallingConvention.DEFAULT,
                enums);
    }
View Full Code Here

        getSingletonClass().addMethod("call", createDynamicMethod(getSingletonClass()));
    }
   
    @JRubyMethod(name = { "new" }, meta = true, required = 2, optional = 2)
    public static IRubyObject newInstance(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) {
        DirectMemoryIO fptr = null;
        RubyHash options = null;
        Object proc = null;
        int optionsIndex = 2;

        Type returnType = org.jruby.ext.ffi.Util.findType(context, args[0]);
View Full Code Here

TOP

Related Classes of org.jruby.ext.ffi.DirectMemoryIO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.