Package com.kenai.jffi

Examples of com.kenai.jffi.Library


        ThreadContext context = runtime.getCurrentContext();

        // Ensure the native code is initialized before we load the library
        Native n = Native.getInstance(runtime);

        Library lib = Library.openLibrary(name, Library.LAZY | Library.GLOBAL);
        if (lib == null) {
            throw new UnsatisfiedLinkError(Library.getLastError());
        }

        String fileName = new File(name).getName();
        String initName = fileName;
        int dotPos;
        if ((dotPos = fileName.lastIndexOf('.')) != -1) {
            // Remove the extension, if needed
            initName = fileName.substring(0, dotPos);
        }
        long init = lib.getSymbolAddress("Init_" + initName);
       
        if (init == 0) {
            throw new UnsatisfiedLinkError("Could not locate Init_" + initName + " module entry point");
        }
       
View Full Code Here


    }
    @JRubyMethod(name = "open" }, meta = true)
    public static final  IRubyObject open(ThreadContext context, IRubyObject recv, IRubyObject libraryName, IRubyObject libraryFlags) {
        final String libName = libraryName.isNil() ? null : libraryName.toString();
        try {
            Library library = Library.getCachedInstance(libName, getNativeLibraryFlags(libraryFlags));
            if (library == null) {
                throw new UnsatisfiedLinkError(Library.getLastError());
            }
            return new DynamicLibrary(context.getRuntime(), (RubyClass) recv,
                    libName, library);
View Full Code Here

    }
    @JRubyMethod(name = "open" }, meta = true)
    public static final  IRubyObject open(ThreadContext context, IRubyObject recv, IRubyObject libraryName, IRubyObject libraryFlags) {
        final String libName = libraryName.isNil() ? null : libraryName.toString();
        try {
            Library library = Library.getCachedInstance(libName, getNativeLibraryFlags(libraryFlags));
            if (library == null) {
                throw new UnsatisfiedLinkError(Library.getLastError());
            }
            return new DynamicLibrary(context.runtime, (RubyClass) recv,
                    libName, library);
View Full Code Here

    }
    @JRubyMethod(name = "open" }, meta = true)
    public static final  IRubyObject open(ThreadContext context, IRubyObject recv, IRubyObject libraryName, IRubyObject libraryFlags) {
        final String libName = libraryName.isNil() ? null : libraryName.toString();
        try {
            Library library = Library.getCachedInstance(libName, getNativeLibraryFlags(libraryFlags));
            if (library == null) {
                throw new UnsatisfiedLinkError(Library.getLastError());
            }
            return new DynamicLibrary(context.runtime, (RubyClass) recv,
                    libName, library);
View Full Code Here

TOP

Related Classes of com.kenai.jffi.Library

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.