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.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 9th December 2006, 13:11   #1  |  Link
3ngel
Registered User
 
Join Date: Mar 2005
Posts: 457
Loading External .dll into AviSynth (LoadDll Plugin Inside)

Hi,
i don't know if this function is already present and i'm not aware of it.
There is a way to load a /system32 .dll directly into .avs without having to put them in the above directory?
Some plugins need external dll to be present in /system32.
There is a way to load them like simple plugins, so they can be stored in other directories other than /system32?
Thanks

UPDATE:
Thank to tsp there is now a plugin "LoadDll" you can download here

Last edited by 3ngel; 18th December 2006 at 17:54.
3ngel is offline   Reply With Quote
Old 9th December 2006, 13:15   #2  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
you can put DLL (not plugin) to any folder, if you add this folder to Path in Windows setting.
__________________
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.
Fizick is offline   Reply With Quote
Old 9th December 2006, 13:16   #3  |  Link
3ngel
Registered User
 
Join Date: Mar 2005
Posts: 457
I would like a solution Windows independent like

LoadSystemDll("Path/Test.dll")
LoadPlugin("PluginThatNeedSystem32dll")

EDIT: In this way you can do simple Autoloading packages with those plugin who requires many external .dlls installed.

Last edited by 3ngel; 9th December 2006 at 13:27.
3ngel is offline   Reply With Quote
Old 9th December 2006, 14:06   #4  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
system DLL is used (called) not by Avisynth but by specific plugin directly.
Fizick is offline   Reply With Quote
Old 9th December 2006, 14:08   #5  |  Link
3ngel
Registered User
 
Join Date: Mar 2005
Posts: 457
But avisynth could do a wrapping method so when the plugin calls the .dll the dll is already in memory (loaded by avisynth with the previous LoadSystemDll)
3ngel is offline   Reply With Quote
Old 9th December 2006, 15:24   #6  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
probably in some other world it could be done so way,
but in our case in existed avisynth and plugins it is implemented differently. (they all must be edited and recompiled).

can you live without it?
Fizick is offline   Reply With Quote
Old 9th December 2006, 15:28   #7  |  Link
3ngel
Registered User
 
Join Date: Mar 2005
Posts: 457
Eheh, ok i can live without it (*sigh*)

3ngel is offline   Reply With Quote
Old 11th December 2006, 02:24   #8  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,556
Not implicitly! If you take them off, all the sudden half your tools won't start. (THANKS A LOT LEADTOOLS. Stupid broken installers.)
foxyshadis is offline   Reply With Quote
Old 11th December 2006, 08:09   #9  |  Link
setarip_old
Registered User
 
setarip_old's Avatar
 
Join Date: Aug 2005
Posts: 16,267
@3ngel

Assuming you have placed the .DLL in your "AVISYNTH" folder, try typing the following line from the "Run" box (available by clicking on the Windows "Start" radiobutton:

c:\windows\system\regsvr32 C:\AVISYNTH\system32.dll (Note the SPACE after "regsvr32")

Last edited by setarip_old; 11th December 2006 at 08:11.
setarip_old is offline   Reply With Quote
Old 11th December 2006, 09:10   #10  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,556
That'll only work on win9x (on nt it's in system32), but since it's on the path using just "regsvr32" works. But here, he's trying to use a standard dll, not a COM server, so loadlibrary won't pick it up even if it does register.

It's possible to read the registry to find the avisynth plugin folder, but there's no requirement for it to be there, so... best to use Ian's solution.
foxyshadis is offline   Reply With Quote
Old 11th December 2006, 09:30   #11  |  Link
3ngel
Registered User
 
Join Date: Mar 2005
Posts: 457
@IanB
but SetWorkingDir() is a avisynth command? (in the case i'll try)

Next i would like to do a simple observation. I don't know in what lang avisynth is written, but in C++ there is a simple LoadLib() that load a .dll in memory.
I don't think is so complicated to wrap the function in a object (assuming is C++) that load a .dll in memory with a "Global Scope" in order to be visible by the plugin called next.
At the end of the script there would be (obviously) another function to unload the .dll from memory UnloadSystemDll()
Is so complicated?

EDIT: In case the plugins are mapped as "out of process" threads you could implement a wide-system hooking technique as explained here.

Last edited by 3ngel; 11th December 2006 at 11:35.
3ngel is offline   Reply With Quote
Old 11th December 2006, 13:06   #12  |  Link
3ngel
Registered User
 
Join Date: Mar 2005
Posts: 457
Quote:
Either install the support .DLL's in the same directory as the Plugin
The point is that some badly written plugins, dumbly look for .dlls only in system32 directory, and not in current dir.
In the late case there would be no problem at all

Quote:
I don't see that it a job for Avisynth to preload arbitary .DLL's.
I disagree on this point, 'cause being Avisynth the "server environment" it has do make available all the instruments to make "client plugins" works in an optimal (including a portable) way. And this includes the possibility to make available to the plugins, external (or even why not modified or optimized) system dlls.
3ngel is offline   Reply With Quote
Old 11th December 2006, 14:18   #13  |  Link
3ngel
Registered User
 
Join Date: Mar 2005
Posts: 457
@IanB
Mine was not a critic, obviously, i was just politely discussing
I didn't want to put the "problem" on you, i was just showing a situation that can happen.
From a user point of view, i am not able to fix the dumb plugin so i expect a little help from the server.
The problem is exactly the opposite: the needed library are not static linked.
Honestly i don't see all this risk.
When a plugin requires external.dll and it's badly written, and it doesnt' find in memory, nor system32 dir, the only thing Avysinth would do is only Preload the needed library (that i specify) in memory, so instead of looking for the disklibrary it finds already in memory. It doesn't involve knowing the name of the functions.
In the specific situation, one of is fft3dfilter that requires fftw3.dll to be put forcefully in system32 (it doesn't work in current dir).

Last edited by 3ngel; 11th December 2006 at 14:21.
3ngel is offline   Reply With Quote
Old 11th December 2006, 15:03   #14  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,556
Ah, but that's because avisynth plugin folder isn't the current working directory, it's the host's. If you put it in virtualdub's folder, and load the script in vdub, it'll load it just fine. (Unless you modified a shortcut to vdub to point to another folder as the cwd, which is one way around all this. But then I think vdub itself wouldn't be too happy.)
foxyshadis is offline   Reply With Quote
Old 13th December 2006, 22:45   #15  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
i get this message private from 3ngel, but it is not private.
Quote:
... i thougt that fftw3.dll was called by your plugin fft3dfilter.dll and so i wasn't able to explain myself why fftw3.dll was not autodownloaded being in the same dir as fft3dfilter.dll. According to Loadlibrary() specification (and my knowledge) among many places to search there is with no doubt current dir. For this reason i asked you to fix the "bug" 'cause i thought you used absolute path.
But now i realized fftw3.dll is called by avisinth itself, infact if i put the fftw3.dll in the same dire as the .avs the library is downloaded.
...
1. fftw3.dll is called not by avisynth itself, but my plugin via LoadLibrary("fftw3.dll").
2. But current path for DLL search is not your the avs dir, but folder of host application (virtualdub or other), that loads the avisynth.
__________________
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.
Fizick is offline   Reply With Quote
Old 14th December 2006, 16:55   #16  |  Link
3ngel
Registered User
 
Join Date: Mar 2005
Posts: 457
Quote:
and manually lookin the same folder as fft3dfilter.dll was loaded from if the first LoadLibrary fails
I had not the "courage" to ask for that, having had the impression Fizick was a little "upsettable" when talking about his plugin, but it would be great if this addition would be made
3ngel is offline   Reply With Quote
Old 14th December 2006, 19:56   #17  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
Put non-plugin DLL at plugin folder is (was ?) bad practice.
__________________
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.
Fizick is offline   Reply With Quote
Old 14th December 2006, 20:02   #18  |  Link
3ngel
Registered User
 
Join Date: Mar 2005
Posts: 457
I don't understand why you say this.
Putting dll in plugin folder makes it much more simple for plugins to work, and obviously totally portable.
3ngel is offline   Reply With Quote
Old 14th December 2006, 20:05   #19  |  Link
tsp
Registered User
 
tsp's Avatar
 
Join Date: Aug 2004
Location: Denmark
Posts: 807
if you put a non-avisynth plugin dll in the avisynth autoload folder avisynth will waste a small amount of time figuring out that the dll is not a plugin when the script is loaded.
__________________
Get my avisynth filters @ http://www.avisynth.org/tsp/
tsp is offline   Reply With Quote
Old 14th December 2006, 20:07   #20  |  Link
3ngel
Registered User
 
Join Date: Mar 2005
Posts: 457
We are not talking about autoloading folder, but in separate dir (that is external plugin dir).
3ngel is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:26.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.