Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
|
|
Thread Tools | Search this Thread | Display Modes |
17th December 2006, 02:39 | #21 | Link |
AviSynth plugger
Join Date: Nov 2003
Location: Russia
Posts: 2,183
|
I would encourage all users to read the plugin docs.
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick I usually do not provide a technical support in private messages. |
17th December 2006, 07:04 | #22 | Link |
Registered User
Join Date: Mar 2005
Posts: 457
|
And i dont' understand what does it cost you to add 3 rows of code as a
// Approx code if(!Loadlibrary("fftw3.dll")) { path=Getcwd() or path=GetDllDirectory() Loadlibrary(path + "fftw3.dll")) } // Second example Path=SetDllDirectory(Getcwd()) or Path=SetDllDirectory(GetDllDirectory()) Last edited by 3ngel; 17th December 2006 at 07:19. |
17th December 2006, 11:26 | #23 | Link |
AviSynth plugger
Join Date: Nov 2003
Location: Russia
Posts: 2,183
|
Why stop here?
Lets search all user hard disk for the DLL, them CDROM, floppy. Not found? Lets repeat full disks search for all Zip archives, and automatically unpack the Dll. Not found? Lets connent to Internet, automatically download and install DLL. Not found? Lets make automatical call to authors phone. Not help? RTFM at last.
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick I usually do not provide a technical support in private messages. |
17th December 2006, 11:30 | #24 | Link |
Registered User
Join Date: Mar 2005
Posts: 457
|
Don't say nonsense.
I think it's a minimum for a plugin to search in its own folder! PS: If my code doesn't work and Getcwd() returns Avisynth dir, then IanB code sure will do. Last edited by 3ngel; 17th December 2006 at 11:51. |
17th December 2006, 14:26 | #25 | Link | ||
Registered User
Join Date: Mar 2005
Posts: 457
|
Quote:
Quote:
The most simple way would be the first i said, that it was avisynth that load the library (through a custom external command LoadExternalDll("path")). At this point having already loaded the library (fftw3.dll) the next plugin requiring it, when it does the loadlibrary it doesn't search in the PATH 'cause it's already available in memory, loaded by avisynth. At the end of the script there would be a freeing command UnloadExternalLibraries("Path") or better UnloadExternalLibraries() with an internal implemented stack that automatically unload all the library references in the stack. Better again .... There is no need for a function. Avisynth automatically call at the end of the script UnloadExternalLibraries() to unload the (eventually) loaded library It seem to you so complicated (even from an avisynth point of view)? Last edited by 3ngel; 17th December 2006 at 14:30. |
||
17th December 2006, 15:06 | #26 | Link |
Registered User
Join Date: Aug 2004
Location: Denmark
Posts: 807
|
3ngel of this 3 solution to your problem with of them seems to be the best?
1) require every user of a filter that needs to load a dll to use a LoadExternalDll command before calling the filter and at the same time requires the developer of avisynth to add the necessary code to the next version and at the same time figure out a way to let the filters get the required handles to the loaded dll. This will also require that the filters to be rewritten and compiled to support this (and it will only work with the new version on avisynth). 2) the filter developer just copy paste the code that Ian provide and include it in the next version of their filter (or the user that really needs this downloads microsoft visual c++ express and make the change themselves) 3) the user copies the external dll to a directory in the PATH (like windows\system32) or modify the PATH so that the plugin directory is included
__________________
Get my avisynth filters @ http://www.avisynth.org/tsp/ |
17th December 2006, 16:16 | #27 | Link | |
Registered User
Join Date: Mar 2005
Posts: 457
|
Personally for me, 2 could be the best (filter developer willingly). Number 1 could also be good because
Quote:
|
|
17th December 2006, 16:32 | #28 | Link | |
Registered User
Join Date: Aug 2004
Location: Denmark
Posts: 807
|
Quote:
__________________
Get my avisynth filters @ http://www.avisynth.org/tsp/ |
|
18th December 2006, 10:41 | #29 | Link |
Registered User
Join Date: Aug 2004
Location: Denmark
Posts: 807
|
sorry 3ngel it was very easy to create the filter (about 20 minutes) . You can download it here.
The only reason not to add it to avisynth was that not many will need it so it may just clutter up the number of built in functions here is the sourcecode for the filter: Code:
// LoadDll // Copyright(C)2006 Tonny Petersen (tsp@person.dk) // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA, or visit // http://www.gnu.org/copyleft/gpl.html . #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #include <windows.h> #include "avisynth.h" BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { return TRUE; } void __cdecl UnloadDll(void* hinst,IScriptEnvironment* env) { if(hinst) FreeLibrary(static_cast<HMODULE>(hinst)); } AVSValue __cdecl LoadDll(AVSValue args, void* user_data, IScriptEnvironment* env){ HMODULE hinst=0; hinst=LoadLibrary(args[0].AsString()); env->AtExit(UnloadDll,hinst); return hinst!=NULL; } extern "C" __declspec(dllexport) const char* __stdcall AvisynthPluginInit2(IScriptEnvironment* env) { env->AddFunction("loaddll", "s", LoadDll, 0); return "loaddll 1.0"; }
__________________
Get my avisynth filters @ http://www.avisynth.org/tsp/ |
18th December 2006, 11:53 | #30 | Link |
Registered User
Join Date: Mar 2005
Posts: 457
|
Fantastic tsp, it works great!
Thank you so much! It wasn't so complicated, nč IanB? (joking eh thanks for you precious code) One question tsp, what happen if i call 2 times the loadll? I see you do a FreeLibrary() only for one instance. On the second instance what happens? Are two separate instances of Loaddll created (so each one frees its own library) or there is one .dll that remains in memory? (i don't know the functioning of avisynth environment) EDIT: I put the link on the first post. Last edited by 3ngel; 18th December 2006 at 11:57. |
18th December 2006, 12:20 | #31 | Link |
Registered User
Join Date: Aug 2004
Location: Denmark
Posts: 807
|
if you have this script:
Code:
loaddll(c:\fftw3.dll") loaddll(c:\fftw3.dll") blackness().converttoyv12() fft3dfilter() the next instance of loaddll increases the reference count to 2(as the dll is already loaded) and finally fft3dfilter increases the reference count to 3 when the script is closed first fft3dfilter is destroyed. This decreases the reference count to 2 (this happends when it calls freelibrary) next avisynth calls UnloadDll from the second instance of loadDll that calls freelibrary that decreases the reference count to 1 and finally avisynth runs the first instance UnloadDll and the reference count decreases to 0 and fftw.dll is unloaded from memory.
__________________
Get my avisynth filters @ http://www.avisynth.org/tsp/ |
27th July 2014, 14:03 | #33 | Link |
Registered User
Join Date: Nov 2005
Posts: 693
|
Because tsp's last activity was on 1st May 2009 and because avisynth.org has moved to avisynth.nl, his filters are now to be found here and LoadDll you can download here.
-------------------------------- BassAudioSource_test.avs: Code:
LoadDll("D:\tak_deco_lib.dll") BassAudioSource("sample(2ch).tak") Playing AviSynth-scripts (with LoadDll) in MPC-HC has never been a problem, but recently I noticed that, unlike with MPC-HC, the above error-message pops up while opening avs-files with ffmpeg.exe, ffplay.exe and avs2pipemod.exe as well. This error always pops up, whatever the map LoadDll is pointing to (even the most simple one, D:\), with the exception of AviSynth's plugin-map. It's not a usage blocking issue though, because ffmpeg.exe, ffplay.exe and avs2pipemod.exe appear to continue/work normally after that, but it is annoying. Does someone with coding experience know how to easily fix this in LoadDll?
__________________
My hobby website |
Thread Tools | Search this Thread |
Display Modes | |
|
|