Filter SDK/Compiling instructions
From Avisynth
Contents |
[edit] Compiling AviSynth Plugins step by step instructions (for MS VC++ 6.0)
<WilbertD> Open VC++
<[T0B1A5]> ok
<WilbertD> file->new->win32 dynamic link library
<[T0B1A5]> wil: empty dll or simple
<WilbertD> empty dll
<WilbertD> go to the project tab -> add to project -> files
<[T0B1A5]> ok
<WilbertD> Here you can add existing cpp or h (headers). Add avisynth.h.
<WilbertD> after that you copied avisynth.h to your folder.
<[T0B1A5]> uh ok
<WilbertD> go to the project tab -> add to project -> new
<WilbertD> select C++ source file, and give it a name.
<WilbertD> go to the project tab -> add to project -> new -> select C/C++ header file (if you are going to use one) -> give it a name.
<[T0B1A5]> done
<WilbertD> Go to Build -> set active configuration -> select the release build.
<WilbertD> Save your workspace: file -> save workspace.
<[T0B1A5]> ok
<WilbertD> Finally, code your source/header files ...
<[T0B1A5]> ...
[edit] How to debug Avisynth plugins
Donald Graft 'neuron2' wrote:
Debugging Avisynth filter DLLs is easy; don't be scared by it. I can tell you how in VC++ 6. :)
1. Build/Active configuration -> Debug.
2. Project/Settings/Debug/General/Executable for debug session -> browse to a version of VirtualDub.exe and specify that.
3. Project/Settings/Debug/Additional DLLs -- browse to the filter DLL in the Debug directory.
4. Make an AVS script that loads and uses your filter -- be sure to load the Debug version!
5. Build the code. Set breakpoints as required.
6. Build/Start debug/Go. VirtualDub will execute. Open the AVS script in that VirtualDub instance.
[edit] Debug info from MAP file
IanB wrote: Recent versions of Avisynth now ship with an avisynth.map! You can use this accurately get routine addresses. Avisynth preferably loads at 0x10000000, use the debugger loaded module display to check this.
Build your plugin in debug mode. If you can, build yourself a Debug or Relsym avisynth.dll and debug it, if not the use the .map file provided to interprete the Call stack addresses.
[edit] Compiling AviSynth Plugins step by step instructions (for MS VC++ 2005 Express Edition)
[edit] Setup VC++ 2005 Express Edition environment
- Install MS VC++ 2005 Express Edition.
http://www.microsoft.com/express/2005/ It is web-based install, but you need to register (which you can do freely).
I prefer manual installation with full CD image download. It may be used on computer without Internet access. http://msdn.microsoft.com/vstudio/express/support/install/ (I can't find the dvd-iso of VC++ 2005 anymore ...)
Run it at least once before installing the SDK
- Install Microsoft Platform SDK
Last version is at http://www.microsoft.com/downloads/details.aspx?FamilyId=0BAF2B35-C656-4969-ACE8-E4C0C0716ADB
Previous versions works fine too (and older February 2003).
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm
It seems, you need install Core component only with Web install, but you may prefer full or ISO download for offline computer.
- Update the Visual C++ directories in the Projects and Solutions section in the Options dialog box.
Add the paths to the appropriate subsection:
Executable files: C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin
Include files: C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include
Library files: C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib
See http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/
- Update the corewin_express.vsprops file.
To make the Win32 template work in Visual C++ Express you need to edit the corewin_express.vsprops file (found in C:\Program Files\Microsoft Visual Studio 8\VC\VCProjectDefaults) and change the string that reads:
AdditionalDependencies="kernel32.lib" to
AdditionalDependencies="kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib"
This step is usually not needed for most AviSynth plugins (kernel.lib is enough), but sometimes you may need in some other library, in particular User.Lib for debug.
- Enable Win32 Windows Application type in the Win32 Application Wizard.
To enable that type, you need to edit the file AppSettings.htm file located in the folder “%ProgramFiles%\Microsoft Visual Studio 8\VC\VCWizards\AppWiz\Generic\Application\html\1033\".
In a text editor comment out lines 441 - 444 by putting a // in front of them as shown here:
// WIN_APP.disabled = true;
// WIN_APP_LABEL.disabled = true;
// DLL_APP.disabled = true;
// DLL_APP_LABEL.disabled = true;
Save and close the file and open Visual C++ Express.
This step is optional if you have project file for plugin (new or old C++ version) and do not create new plugin from scratch.
[edit] How to compile existant (old MS VC 6.0) plugin with MS VC++ 2005
- Start VC++ 2005, go to folder with old plugin (e.g. SimpleSample) unpacked zip file with full source codes and project files, and open plugin workspace file SimpleSample.dsw.
- Agree in dialog to convert and open this project.
- Go to menu Build -> Configuration Manager, Set active solution configuration to Release (or Debug if you want firsly debug it).
- Go to Build -> Build Solution (F7) to compile and create SimpleSample.dll
- If you get fatal error LNK1181: cannot open input file 'odbc32.lib', then go to menu Project -> SimpleSample Properties. Select Configuration Properties -> Linker -> Input -> Additional Dependencies, and remove extra unneeded libraries like odbc32.lib, odbccp32.lib.
- Also check Linker -> Output File option there and set approriate pathname (or Inherit From Process default).
- You can make some changes (edit) of source codes if you want.
- Repeat command Build -> Build Solution (F7) to compile and create SimpleSample.dll
[edit] How to create new plugin from scratch with MS VC++ 2005
- Start VC++2005.
- Menu: fiIe -> Create new project.
- Select Win32 console appication.
- Enter name of your new project and press OK.
- You will in Win32 Appcilation Wizard. Press Application Settings (left panel).
- Select Application Type as DLL (but it may be console too).
- At Additional options select "Empty project"
- Copy files to project folder with Explorer.
- Add header file avisynth.h to the project: Menu Project -> Add existent item. Also add existant (e.g. simplesample.cpp) or create new CPP files by Project -> Add new item.
- Go to menu Build -> Configuration Manager, Set active solution configuration to Release (or Debug if you want firsly debug it).
- Make some changes (edit) of source codes to implement your algorithm. See SimpleSample or some other open source plugin source code and Avisynth Filter SDK for details.
- Go to Build -> Build Solution (F7) to compile and create plugin SimpleSample.dll

