Exemple #1
0
        private static void InternalTryLoadLibraryAtHint()
        {
            // Directory separator should not appear in library name
            // see: http://www.chilkatsoft.com/p/p_499.asp
            var hint = Path.Combine(InternalGetHintPath(), CPtrLibrary.LibraryPath) + ".dll";


            try
            {
                JavaSystem.load(hint);
            }
            catch (csharp.ThrowableException ex)
            {
                ((Throwable)(object)ex).printStackTrace();
                throw new System.InvalidOperationException("Failed to loadLibrary: " + CPtrLibrary.LibraryPath + " or " + hint);
            }
        }
Exemple #2
0
        private static void InternalTryLoadLibrary()
        {
            try
            {
                //System.Console.WriteLine("InternalTryLoadLibrary");

                var p = __PlatformInvocationServices.Func.GetCodeSourceLocation();

                //System.Console.WriteLine("p: " + p);

                var lib = Path.Combine(Path.GetDirectoryName(p), CPtrLibrary.LibraryPath);

                var IsLibMissing = !File.Exists(lib);
                var IsExtExports = p.EndsWith(".exports");

                var value = IsLibMissing;

                if (!IsExtExports)
                {
                    value = false;
                }

                if (value)
                {
                    JavaSystem.load(p);
                }
                else
                {
                    JavaSystem.loadLibrary(CPtrLibrary.LibraryPath);
                }
            }
            catch //(csharp.ThrowableException ex)
            {
                //System.Console.WriteLine("InternalTryLoadLibrary error");
                //((Throwable)(object)ex).printStackTrace();

                InternalTryLoadLibraryAtHint();
            }
        }