Exemplo n.º 1
0
        public static void loadPatch()
        {
            if (loader == null)
            {
                loader = IsLinux() ? (IDllLoader) new LinuxDllLoader() : (IDllLoader) new WindowsDllLoader();
            }
            SDllHandle = loader.LoadLibrary("libpdcsharp." + (IsLinux() ? "so" : "dll"));
            LibPD.ReInit();

            LibPD.OpenAudio(2, 3, 44100);
            SPatch = LibPD.OpenPatch(@"../../test_csharp.pd");
            LibPD.ComputeAudio(true);
        }
Exemplo n.º 2
0
 static void LoadDll(string nativeDll)
 {
     if (dllHandle == IntPtr.Zero)
     {
         dllHandle = loader.LoadLibrary(nativeDll);
         if (dllHandle != IntPtr.Zero)
         {
             Console.WriteLine("Loaded: " + nativeDll);
         }
         else
         {
             Console.WriteLine("Couldn't load: " + nativeDll);
         }
     }
 }
Exemplo n.º 3
0
        /// <summary>
        ///   Loads the DLL module and returns an instance of <see cref="NativeDll" /> class.
        /// </summary>
        /// <param name="path">The absolute path of a DLL to load.</param>
        public static NativeDll LoadDll(string path)
        {
            if (string.IsNullOrEmpty(path))
            {
                throw new ArgumentNullException("path");
            }

            var file = AddDynamicLibrarySuffix(StripExistingDynamicLibrarySuffix(path));

            if (!File.Exists(file))
            {
                throw new ArgumentException(string.Format("Dynamic library {0} is not found by path {1}", file.QuoteIfNeeded(), file.QuoteIfNeeded()));
            }

            var handle = ourDllLoader.LoadLibrary(file);

            return(new NativeDll(handle.ToPointer(), file, ourDllLoader));
        }