Package com.kenai.jffi

Examples of com.kenai.jffi.Function


            if ((jffiParamTypes[i] = FFIUtil.getFFIType(parameterTypes[i])) == null) {
                throw runtime.newArgumentError("Invalid parameter type " + parameterTypes[i]);
            }
        }
       
        function = new Function(fptr.getAddress(), jffiReturnType, jffiParamTypes);
        this.parameterTypes = (Type[]) parameterTypes.clone();
        this.returnType = returnType;
        this.convention = convention;
        this.enums = enums;
        // Wire up Function#call(*args) to use the super-fast native invokers
View Full Code Here


                    break;
            }
        }

        Invocation invocation = new Invocation(context);
        Function function = new Function(address.getAddress(), returnType, ffiParamTypes, convention);
        try {
            HeapInvocationBuffer args = new HeapInvocationBuffer(function);
            for (int i = 0; i < marshallers.length; ++i) {
                marshallers[i].marshal(invocation, args, params[i]);
            }

            return functionInvoker.invoke(context, function, args);
        } finally {
            invocation.finish();
            function.dispose();
        }
    }
View Full Code Here

            // Allow individual methods to set the calling convention to stdcall
            CallingConvention callingConvention = method.isAnnotationPresent(StdCall.class)
                    ? CallingConvention.STDCALL : libraryCallingConvention;

            Function function = new Function(functionAddress,
                    getCallContext(resultType, parameterTypes, callingConvention, InvokerUtil.requiresErrno(method)));

            Invoker invoker = invokerFactory.createInvoker(runtime, library, function, resultType, parameterTypes);

            //
View Full Code Here

    }


    private static Function getFunction(long address, ResultType resultType, ParameterType[] parameterTypes,
                                        boolean requiresErrno, CallingConvention convention) {
        return new Function(address, InvokerUtil.getCallContext(resultType, parameterTypes, convention, requiresErrno));
    }
View Full Code Here

            // Allow individual methods to set the calling convention to stdcall
            CallingConvention callingConvention = m.getAnnotation(StdCall.class) != null
                    ? CallingConvention.STDCALL : libraryCallingConvention;
            boolean saveErrno = InvokerUtil.requiresErrno(m);
            Function function;
            try {
                function = getFunction(library.findSymbolAddress(functionName),
                    resultType, parameterTypes, saveErrno, callingConvention);
            } catch (SymbolNotFoundError ex) {
                cv.visitField(ACC_PRIVATE | ACC_FINAL | ACC_STATIC, "error_" + i, ci(String.class), null, ex.getMessage());
View Full Code Here

            if ((jffiParamTypes[i] = FFIUtil.getFFIType(parameterTypes[i])) == null) {
                throw runtime.newArgumentError("Invalid parameter type " + parameterTypes[i]);
            }
        }
       
        function = new Function(fptr.getAddress(), jffiReturnType, jffiParamTypes);
        this.parameterTypes = (Type[]) parameterTypes.clone();
        this.returnType = returnType;
        this.convention = convention;
        this.enums = enums;
        // Wire up Function#call(*args) to use the super-fast native invokers
View Full Code Here

                    break;
            }
        }

        Invocation invocation = new Invocation(context);
        Function function = new Function(address.getAddress(), returnType, ffiParamTypes, convention);
        try {
            HeapInvocationBuffer args = new HeapInvocationBuffer(function);
            for (int i = 0; i < marshallers.length; ++i) {
                marshallers[i].marshal(invocation, args, params[i]);
            }
View Full Code Here

            if ((jffiParamTypes[i] = FFIUtil.getFFIType(parameterTypes[i])) == null) {
                throw runtime.newArgumentError("Invalid parameter type " + parameterTypes[i]);
            }
        }
       
        function = new Function(fptr.address(), jffiReturnType, jffiParamTypes);
        this.parameterTypes = (Type[]) parameterTypes.clone();
        this.returnType = returnType;
        this.convention = convention;
        this.enums = enums;
        // Wire up Function#call(*args) to use the super-fast native invokers
View Full Code Here

                        resultContext.getAnnotations(), typeMapper.getFromNativeType(signatureType, resultContext),
                        resultContext);

                ParameterType[] parameterTypes = getParameterTypes(runtime, typeMapper, function.getMethod());

                Function jffiFunction = new Function(functionAddress,
                        getCallContext(resultType, parameterTypes,function.convention(), function.isErrnoRequired()));

                for (MethodGenerator g : generators) {
                    if (g.isSupported(resultType, parameterTypes, function.convention())) {
                        g.generate(builder, function.getMethod().getName(), jffiFunction, resultType, parameterTypes, !function.isErrnoRequired());
View Full Code Here

            // Allow individual methods to set the calling convention to stdcall
            CallingConvention callingConvention = method.isAnnotationPresent(StdCall.class)
                    ? CallingConvention.STDCALL : libraryCallingConvention;

            Function function = new Function(functionAddress,
                    getCallContext(resultType, parameterTypes, callingConvention, InvokerUtil.requiresErrno(method)));

            Invoker invoker = invokerFactory.createInvoker(runtime, library, function, resultType, parameterTypes);

            //
View Full Code Here

TOP

Related Classes of com.kenai.jffi.Function

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.