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. |
|
11th November 2013, 02:42 | #1 | Link |
Registered User
Join Date: Apr 2008
Location: California, USA
Posts: 127
|
Unable to compile an AviSynth C++ DLL
I recently began working with Orwell Dev-C++ on my Win-7 32-bit PC to create DLLs for use with AviSynth 2.58. I saved avisynth.h (http://avisynth.nl/images/Avisynth.h-2.5.8.avs) in (MingGW32\include). However, compiling causes
[error] can't create precompiled header c:\program files\dev-cpp\mingw32\include\avisynth.exe: Permissions denied I tried saving it in (MinGW32\lib\gcc\mingw32\4.7.2\include), but the result was the same. Any suggestions? |
11th November 2013, 05:52 | #2 | Link | |
Registered User
Join Date: Feb 2008
Location: Finland
Posts: 141
|
Quote:
Edit: I strongly suggest of downloading QT5.1 SDK and QT Creator. There is simple create DLL method that implements QT dll structure and shows your first DLL function right away including header class to export your functions. Whats best is, that you are making Cross platform version of your dll's. Last edited by Jeroi; 11th November 2013 at 05:59. |
|
11th November 2013, 06:00 | #3 | Link | |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,018
|
Avisynth.h is part of your project and should be in same directory as your source files,
included with Code:
#include "Avisynth.h" Code:
#include <Avisynth.h> You might find more assistance if you post in one of the Avisynth Developer forum sticky threads, also at least until more comfortable with C/CPP, maybe try out MS Express editions or one of the other compilers mentioned in the stickies threads. EDIT: Quote:
EDIT: And start with the Simple Sample stuff in Avisynth Developer forum SDK sticky thread.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 11th November 2013 at 06:18. |
|
17th November 2013, 16:51 | #4 | Link | |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,433
|
Quote:
Rather than have a copy of avisynth.h in every project source file directory, I prefer just to add the containing folder (eg C:\Program Files\AviSynth 2.5\FilterSDK\include) to the list of include directories for the project. I then use #include <avisynth.h>. |
|
11th November 2013, 09:11 | #5 | Link |
Registered User
Join Date: Apr 2008
Location: California, USA
Posts: 127
|
First off...thank you. My goal is to create a GUI for AVIsynth and VapourSynth. Think of it as AVSpmod on steroids, but specifically targeting the world of video forensics. I have a strong familiarity with Javascript and AVIsynth scripts, but all this CPP C# stuff is new to me (and rather reminiscent of circa 1970's Cobol)?
Jeroi, I have no loyalty to Orwell C++, and will gladly download Qt 5.1.1 for Windows 32-bit. Do you recommend that I go with VS 2012 -or- MinGW 4.8, OpenGL? I already have Aivisynth.h from the link in my original post. Where do I get avisynthdll.h plus the winapi32 libraries you mentioned? |
11th November 2013, 13:14 | #6 | Link | |
Registered User
Join Date: Feb 2008
Location: Finland
Posts: 141
|
Quote:
When you install Mingw to some harddisk root, then QT will ask you where the Mingw is located and then add your combilers to QT configs. So you can use mingw to combile your code in QT Creator and debug aswell. |
|
11th November 2013, 17:51 | #7 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,018
|
Just for your info Forensic, the Avisynth.h header you linked, is a version 3 header for 2.5 plugins, you might also
want version 5 for v2.6 plugins, latest of both can be found in source of any of the 25&26 plugins on MediaFire in my sig (eg RT_Stats). Check in SDK stickies to see if other people have successfully used MingW for plugin development, once familiar with the language, you can switch to whatever compiler you want provided it links nice with MS dll's and CPP binary compatible.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
12th November 2013, 13:03 | #8 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,018
|
It looks to me as though you cannot compile an autoloading CPP plugin using MingW, only manual loading C plugins and so you would need the Kevin Atkinson
Avisynth_c.h header, think it was updated not so long ago, but dont know where to get update. See also Compiling Avisynth plugins and Avisynth Plugin development in C on Avisynth.nl main page here: http://www.avisynth.nl/index.php/Main_Page#Development the Development in C link actually takes you here: http://avisynthnew.wikinet.org/wiki/...velopment_in_C, looks to be written by Jmac968 who was not so very long ago, an non CPP programmer. and the links here: http://forum.doom9.org/showthread.ph...35#post1651935
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 12th November 2013 at 16:21. |
12th November 2013, 15:02 | #9 | Link | |
Registered User
Join Date: Feb 2008
Location: Finland
Posts: 141
|
Quote:
So soon there is valid avisynth.H for c++ QT. And it's exiting thingy because QT Creator can make DLL projects with couble clicks and then using qt_avisynth.h inside the dll you can have your nasty object oriented programming and generate nice plugins for free. The reason why g++ fails with avisynth.H is that it uses object.H which is m$ file. Also it uses some windows io.H headers to be able to talk with Windows. MinGW misses I think object.H atleast in winapi support and other activeX related things. Last edited by Jeroi; 12th November 2013 at 16:29. |
|
12th November 2013, 16:25 | #10 | Link | |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,018
|
Quote:
EDIT: Good luck to both of you.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
|
14th November 2013, 23:41 | #11 | Link |
Registered User
Join Date: Apr 2008
Location: California, USA
Posts: 127
|
Handaimoah: my question is, from your expertise, should the MSVC++ version (Microsoft Visual Studio Express 2012 for Windows Desktop) along with (Qt 5.1.1 for Windows 32-bit VS 2012) be compatible with avisynth.h (2.5 v3) {http://avisynth.nl/images/Avisynth.h-2.5.8.avs} for the development of DLLs? Is there anything else I will need?
|
15th November 2013, 00:03 | #12 | Link | |
Registered User
Join Date: Feb 2008
Location: Finland
Posts: 141
|
Quote:
|
|
17th November 2013, 01:57 | #13 | Link |
Registered User
Join Date: Apr 2008
Location: California, USA
Posts: 127
|
I installed minGW32 and successfully compiled a static CPP build through TextPad (http://youtu.be/65aTci7dh04), but it lacks any debugging beyond a useless "error code 1" and only creates an EXE. I found ample Avisynth DLL compiling instructions, but those either require purchasing the Professional version of VC++, using software that is no longer available, or using older software that is incompatible with my Windows-7 32-bit PC. I believe it is possible to use QT5.1 (for ease of creating/debugging CPP code) with my minGW32 to create a static Avisynth 2.58 compliant CPP DLL, but I can't figure how.
I have the Avisynth.h (2.58 ver 3) file. What I can't figure out are the actual steps to convert a known valid Avisynth 2.58 CPP script into a static build Avisynth 2.58 compliant DLL. I am seeking the compiling instructions, including where to place the Avisynth.h file and any other Avisynth files required for a successful build. If QT and/or minGW32 is an invalid development tool, then I will use whatever you know will work. Once I have successfully compiled one DLL, I am ready to do this for many. Can anyone help? |
17th November 2013, 02:39 | #15 | Link | |
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
|
Quote:
The Platform SDK that goes with it should be this one. You should have no problems building Avisynth plugins with this environment. Edit: neuron2 beat me to it... Edit1: Here is a link to Code::Blocks and how to integrate the VC7.1 compiler into their IDE. I heard some good things about that IDE, give it a go. Last edited by Groucho2004; 17th November 2013 at 03:25. |
|
17th November 2013, 03:43 | #16 | Link |
Registered User
Join Date: Apr 2008
Location: California, USA
Posts: 127
|
Last week I installed "Microsoft Visual Studio 2012 Express" and, based on today's advice, I installed "Microsoft Visual C++ Toolkit 2003" and "Microsoft Platform SDK for Windows Server 2003 R2". I have no problem writing a hello world script and am getting the initial hang of CPP structure. I have compiled scripts into EXEs using the minGW32-TextPad setup as noted previously.
I am sorry to bother you, but I am stopped by the hurdle of how to create an Avisynth 2.58 compliant DLL, regardless of its simplicity. I am not asking for help on writing a script, just the configuration steps and additional files (e.g. other "h" files) needed to get to the finish line. Any advice? To address neuron2's question, I am building DLLs now with the eventual goal of writing a complete GUI application. |
17th November 2013, 06:52 | #17 | Link |
Excessively jovial fellow
Join Date: Jun 2004
Location: rude
Posts: 1,100
|
This forum sure has been full of people getting in way over their heads lately. Jeroi has always been beyond all help, but for you others, I'd like to mention the following about Avisynth plugin development:
The Avisynth API is a C++ API, and C++ API's are a terrible idea because different compilers have different ideas about what the ABI should look like. In practice, this means that if you want things to work 100% as expected, YOU MUST COMPILE YOUR PLUGIN WITH THE SAME COMPILER THAT WAS USED TO COMPILE AVISYNTH. That's MSVC 6.0 for official builds. Later versions of MSVC will kinda sorta work, as will ICL, but there are caveats (for example, you must never allow any C++ exceptions to escape your plugin ever - see this post by ultim for details - and you must always make sure memory allocated by Avisynth is freed by Avisynth itself and not by your plugin). MinGW most definitely doesn't work, and that's why the Avisynth C API exists: if you want a portable API, you want a C API. C++ API's are more or less by definition unportable, and Jeroi is (obviously) delusional. Avisynth itself (the official branch) relies on a ton of Windows-specific and MSVC-specific things and you shouldn't even bother trying to compile with anything else. Even if you rewrote or removed all the unportable parts (like Avxsynth) compiling it with a different compiler would make your Avisynth incompatible with existing plugins (except possibly the ones using the C interface, heh). By the way, it should be obvious, but just in case: if your intention is not to write a plugin but rather to use the Avisynth API from a standalone application, all of the above still applies. Especially the exception handling part. Last edited by TheFluff; 17th November 2013 at 06:54. |
17th November 2013, 11:36 | #18 | Link | |
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
|
Quote:
BTW, I'm using VC6 with ICL10.1 which is the last ICL version that is compatible with VC6. |
|
17th November 2013, 09:02 | #19 | Link |
Registered User
Join Date: Apr 2008
Location: California, USA
Posts: 127
|
First off, thank you for all the guidance, advice and links. Sorry about calling CPP code a script (force of habit). I promise to move slowly and heed the wisdom of others. C# and C++ are new to me, and my immediate goal is a greater understanding of its structure and syntax, in addition to the coding aspects unique to Avisynth and VapourSynth. First task... researching the cause of my two errors with the sample CPP code. I am sure that I am making a common newbie mistake:
warning C4627: '#include "avisynth.h"': skipped when looking for precompiled header use error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source? |
17th November 2013, 15:02 | #20 | Link | |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,018
|
Quote:
set to my Projects directory and Win32 box ticked. Give it a Project name eg 'Sin'. I next step, I always select 'An Empty DLL Project' (avoids that stdafx stuff). In FilesView Add avisynth.h (and any other of your self made headers) to the Header Files Add Sin.cpp to the Source Files. Sin.CPP (From SDK NON-ClipSample) Code:
#include <windows.h> // from compiler/SDK include dir #include <math.h> // from compiler/SDK include dir #include "avisynth.h" // In your project dir AVSValue Sin(AVSValue args, void* user_data, IScriptEnvironment* env) { return sin(args[0].AsFloat()); } extern "C" __declspec(dllexport) const char* __stdcall AvisynthPluginInit2(IScriptEnvironment* env) { env->AddFunction("sin", "f", Sin, 0); return "sin"; } By The Way, this is how I have my Menu/Tools/Options/Directories set for VS6 + ToolKit 2003 + SDK: Executable Files::: C:\Program Files\Microsoft SDK\bin C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin C:\Program Files\Microsoft Visual Studio\VC98\BIN C:\Program Files\Microsoft SDK\bin\winnt C:\Program Files\Microsoft Visual Studio\COMMON\TOOLS C:\Program Files\Microsoft Visual Studio\COMMON\MSDev98\Bin C:\Program Files\Microsoft Visual Studio\COMMON\TOOLS\WINNT C:\WINDOWS\system32 C:\WINDOWS C:\WINDOWS\System32\Wbem C:\Program Files\Intel\DMIX C:\WINDOWS\system32\WindowsPowerShell\v1.0 C:\Program Files\Support Tools Include Files::: C:\Program Files\Microsoft SDK\include C:\Program Files\Microsoft Visual C++ Toolkit 2003\include C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE C:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE Library Files::: C:\Program Files\Microsoft SDK\lib C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib C:\Program Files\Microsoft Visual Studio\VC98\LIB C:\Program Files\Microsoft Visual Studio\VC98\MFC\LIB Only first 3 files of each section really relevent, I put VC98 entries above Toolkit 2003 normally (and for debugging as ToolKit 2003 has no debugging), and for final, switch TK2003 above VC98. Hopefully not too dissimilar to VC2012. PS, you might find the Avisynth Compiled Help With SDK (CHM) File for v2.6 useful (MediaFire in sig), stick it on a hot-Key.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 20th November 2013 at 18:09. |
|
Tags |
avisynth, c++, compile, dll |
Thread Tools | Search this Thread |
Display Modes | |
|
|