Example #1
0
        public static IntPtr LoadFunctionPointer(IntPtr nativeLibraryHandle, string functionName)
        {
            Eina.Log.Debug("searching {nativeLibraryHandle} for {functionName}");
            var s = FunctionInterop.dlsym(nativeLibraryHandle, functionName);

            Eina.Log.Debug("searching {nativeLibraryHandle} for {functionName}, result {s}");
            return(s);
        }
Example #2
0
        /// <summary>Loads a function pointer from the default module.
        /// <para>Since EFL 1.23.</para>
        /// </summary>
        /// <param name="functionName">The name of the function to search for.</param>
        /// <returns>A function pointer that can be used with delegates.</returns>
        internal static IntPtr LoadFunctionPointer(string functionName)
        {
            Eina.Log.Debug($"searching {null} for {functionName}");
            var s = FunctionInterop.dlsym(IntPtr.Zero, functionName);

            Eina.Log.Debug($"searching {null} for {functionName}, result {s}");
            return(s);
        }
Example #3
0
        /// <summary>Loads a function pointer from the given module.
        /// <para>Since EFL 1.23.</para>
        /// </summary>
        /// <param name="moduleName">The name of the module containing the function.</param>
        /// <param name="functionName">The name of the function to search for.</param>
        /// <returns>A function pointer that can be used with delegates.</returns>
        internal static IntPtr LoadFunctionPointer(string moduleName, string functionName)
        {
            IntPtr module = NativeModule.LoadLibrary(moduleName);

            Eina.Log.Debug($"searching {module} for {functionName}");
            var s = FunctionInterop.dlsym(module, functionName);

            Eina.Log.Debug($"searching {module} for{functionName}, result {s}");
            return(s);
        }
Example #4
0
            ///<summary>Loads a function pointer from the given module.</summary>
            ///<param name="moduleName">The name of the module containing the function.</param>
            ///<param name="functionName">The name of the function to search for.</param>
            ///<returns>A function pointer that can be used with delegates.</returns>
            public static IntPtr LoadFunctionPointer(string moduleName, string functionName)
            {
                NativeModule module = new NativeModule(moduleName);

                Eina.Log.Debug($"searching {module.Module} for {functionName}");
                var s = FunctionInterop.dlsym(module.Module, functionName);

                Eina.Log.Debug($"searching {module.Module} for{functionName}, result {s}");
                return(s);
            }
Example #5
0
        private NativeModule module; // so it doesn't get unloaded
#pragma warning restore 0414

        private static FunctionLoadResult <T> LazyInitialization(NativeModule module, string functionName)
        {
            if (module.Module == IntPtr.Zero)
            {
                return(new FunctionLoadResult <T>(FunctionLoadResultKind.LibraryNotFound));
            }
            else
            {
                IntPtr funcptr = FunctionInterop.LoadFunctionPointer(module.Module, functionName);
                if (funcptr == IntPtr.Zero)
                {
                    return(new FunctionLoadResult <T>(FunctionLoadResultKind.FunctionNotFound));
                }
                else
                {
                    return(new FunctionLoadResult <T>(Marshal.GetDelegateForFunctionPointer <T>(funcptr)));
                }
            }
        }
Example #6
0
 private static IntPtr LoadFunctionPointer(IntPtr nativeLibraryHandle, string functionName)
 => FunctionInterop.GetProcAddress(nativeLibraryHandle, functionName);