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 11th November 2013, 02:42   #1  |  Link
Forensic
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?
Forensic is offline   Reply With Quote
Old 11th November 2013, 05:52   #2  |  Link
Jeroi
Registered User
 
Join Date: Feb 2008
Location: Finland
Posts: 141
Quote:
Originally Posted by Forensic View Post
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?
Just create your folder anywhere on your system. It does not need to be at there where you placed it. Just remember when you compile with make, remember to check $PATH variable so that /usr/lib is there and use "export PATH=yourpath:another:another" to include all the necessary folders. Aivisynth.h and avisynthdll.h needs winapi32 libraries so that's why you need to check the path environment variable. How ever isin't avisynth .NET?

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.
Jeroi is offline   Reply With Quote
Old 11th November 2013, 06:00   #3  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
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"
rather than
Code:
#include <Avisynth.h>
which includes from the compiler include paths.
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:
How ever isin't avisynth .NET?
No.

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.
StainlessS is offline   Reply With Quote
Old 11th November 2013, 09:11   #4  |  Link
Forensic
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?
Forensic is offline   Reply With Quote
Old 11th November 2013, 13:14   #5  |  Link
Jeroi
Registered User
 
Join Date: Feb 2008
Location: Finland
Posts: 141
Quote:
Originally Posted by Forensic View Post
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?
Mingw+QT5.1+qt creator is free opensource toolchain. With mingw you can use GIT also or SVN to track your progress.

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.
Jeroi is offline   Reply With Quote
Old 11th November 2013, 17:51   #6  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
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 ???
StainlessS is offline   Reply With Quote
Old 12th November 2013, 13:03   #7  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
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.
StainlessS is offline   Reply With Quote
Old 12th November 2013, 15:02   #8  |  Link
Jeroi
Registered User
 
Join Date: Feb 2008
Location: Finland
Posts: 141
Quote:
Originally Posted by StainlessS View Post
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 C programmer.

and the links here: http://forum.doom9.org/showthread.ph...35#post1651935
I have almoust already ported avisynth.h to QT in my MeXgui project. I need to rewrite com controlls in it to be able to combile and some windows objects related code still to debug. Once this is done, Avisynth.H will support crossplatform native plugin development with QT. I will rename it to Avisythqt.H or QT_Avisynth.H or similar.

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.
Jeroi is offline   Reply With Quote
Old 12th November 2013, 16:25   #9  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,018
Quote:
Originally Posted by Jeroi View Post
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.
Sound good to me. Good luck with your new project.

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 ???
StainlessS is offline   Reply With Quote
Old 14th November 2013, 23:41   #10  |  Link
Forensic
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?
Forensic is offline   Reply With Quote
Old 15th November 2013, 00:03   #11  |  Link
Jeroi
Registered User
 
Join Date: Feb 2008
Location: Finland
Posts: 141
Quote:
Originally Posted by Forensic View Post
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?
Afaik you don't need QT for avisynth plugins, since you are handling video or audio so it is mathematical calculation basically so no need for QT which is GUI development SDK to provide crostool support natively to GUI programs.
Jeroi is offline   Reply With Quote
Old 17th November 2013, 01:57   #12  |  Link
Forensic
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?
Forensic is offline   Reply With Quote
Old 17th November 2013, 02:20   #13  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
Quote:
Originally Posted by Forensic View Post
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.
You have mentioned this before but it still evades me what you mean by "cpp script". Could you post the content of such a file?
Groucho2004 is offline   Reply With Quote
Old 17th November 2013, 02:39   #14  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
Quote:
Originally Posted by Forensic View Post
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.
Here is a link for the free MS VC7.1 compiler which should work on your system.
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.
Groucho2004 is offline   Reply With Quote
Old 17th November 2013, 03:43   #15  |  Link
Forensic
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.
Forensic is offline   Reply With Quote
Old 17th November 2013, 06:52   #16  |  Link
TheFluff
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.
TheFluff is offline   Reply With Quote
Old 17th November 2013, 09:02   #17  |  Link
Forensic
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?
Forensic is offline   Reply With Quote
Old 17th November 2013, 11:36   #18  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
Quote:
Originally Posted by TheFluff View Post
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).
All true but I'd venture a guess that less than 20% of existing plugins are built with VC6 since people just don't have it - just some dinosaurs like me.
BTW, I'm using VC6 with ICL10.1 which is the last ICL version that is compatible with VC6.
Groucho2004 is offline   Reply With Quote
Old 17th November 2013, 11:56   #19  |  Link
TurboPascal7
Registered User
 
TurboPascal7's Avatar
 
Join Date: Jan 2010
Posts: 270
Quote:
Originally Posted by Groucho2004 View Post
BTW, I'm using VC6 with ICL10.1 which is the last ICL version that is compatible with VC6.
Omg, why?
And here I considered you a possible avs+ contributor.
__________________
Me on GitHub | AviSynth+ - the (dead) future of AviSynth
TurboPascal7 is offline   Reply With Quote
Old 17th November 2013, 12:04   #20  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
Quote:
Originally Posted by TurboPascal7 View Post
Omg, why?
And here I considered you a possible avs+ contributor.
I also have various other compilers, like VC10 which I use for most other purposes than things related to the "official" Avisynth.
Groucho2004 is offline   Reply With Quote
Reply

Tags
avisynth, c++, compile, dll

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 05:02.


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