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. |
5th November 2011, 17:01 | #1 | Link |
Registered User
Join Date: Jan 2006
Posts: 1,867
|
Create DLL with Code::Blocks
This sounds like a silly problem, but I just can't get it to work. I tried compiled a plugin in Code::Blocks, and it compiled with no errors, however no dll was created. Instead, some libName.dll.a and Name.def were made.
I tried that .a file but it won't load as a plugin. How do I make the real dll? |
5th November 2011, 17:31 | #2 | Link |
Excessively jovial fellow
Join Date: Jun 2004
Location: rude
Posts: 1,100
|
If you want to compile native Avisynth plugins (as opposed to stdcall plugins, aka. c-plugins) you can't use Code::Blocks (since it uses g++; native Avisynth plugins must be built with MSVC since C++ is retarded).
I have never used Code::Blocks myself, but .a is the conventional Linux file name ending for static libraries. |
5th November 2011, 17:35 | #3 | Link |
Registered User
Join Date: Jan 2006
Posts: 1,867
|
Hi,
I am compiling a C plugin. Code Blocks also supports many compilers, including the MSVC compiler. Btw, do you know exactly what is different with the compilers in C++? I mean why they can't be compatible... wouldn't it be theoretically possible to write a binary converter of some sort? What a stupid standard if C++ can't be compatible. |
5th November 2011, 17:50 | #4 | Link | ||
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
Quote:
From http://en.wikipedia.org/wiki/Name_mangling: Quote:
|
||
5th November 2011, 17:56 | #5 | Link | |
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
|
Quote:
Of course, if you write something that largely depends on M$ libraries, conventions, etc., portability goes out the window. |
|
5th November 2011, 18:05 | #6 | Link |
Registered User
Join Date: Jan 2006
Posts: 1,867
|
Looks like it is possible to use g++ for native Avisynth plugins. There's two ways to do this, one specifies a conversion between the name mangling, and another method which is easier.
http://www.codeguru.com/forum/archiv.../t-343634.html Still didn't help me make my dll though Gavino, Certainly you could try compiling http://avisynth.org/warpenterprises/...c_20071206.zip with your setup and report the project file settings? I can't write a guide nor make any plugins until I can compile Last edited by jmac698; 5th November 2011 at 18:07. |
5th November 2011, 18:12 | #7 | Link | |
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
|
Quote:
|
|
5th November 2011, 18:26 | #8 | Link |
Registered User
Join Date: Jan 2006
Posts: 1,867
|
That's not the problem, even if I used vc2003 compiler with Code::Blocks I'd have the same problem. I've also avoided vc for two reasons; it's over 1GB of download to write avisynth plugins, and I don't know C++.
Also, learning VC doesn't help me in the long run, I compile a lot of cross-platform code; see my compiling FFMBC guide http://forum.doom9.org/showthread.php?t=162615 This is already a big jump for me; I started with Bloodshed Dev-C which is only 8mb and worked fine for me, however it's not updated anymore. Last edited by jmac698; 5th November 2011 at 18:30. |
5th November 2011, 18:31 | #9 | Link | |
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
|
Quote:
http://xona.com/2004/06/29.html Edit: OK you'll also need the platform SDK but that's also not that big. No idea what this has to do with compiling a C plugin. |
|
5th November 2011, 18:33 | #10 | Link | |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
Quote:
It shows the linker command to create the dll should look like (start with): g++ -shared -o demosaic.dll ... You should see this in the build log when you try to build. |
|
5th November 2011, 18:39 | #11 | Link |
Registered User
Join Date: Jan 2006
Posts: 1,867
|
Yes I believe I was able to use the makefile in the past (though I had quite some difficulty getting it to work), however I want to find a solution that's automated, ie doesn't need to customize a makefile.
If you open the cbp project file, it's xml and fairly clear what it's doing. I have a working and non-working cbp side-by-side and I just don't see why one works. One difference I spotted is Code:
<Compiler> <Add option="-DBUILDING_DLL=1" /> Code:
<Option createStaticLib="1" /> The project which works is the imported .dev file from my former setup of Bloodshed Dev-C Last edited by jmac698; 5th November 2011 at 18:42. |
5th November 2011, 18:39 | #12 | Link | ||
Registered User
Join Date: Jan 2006
Posts: 1,867
|
My build log:
Quote:
Quote:
|
||
5th November 2011, 19:02 | #13 | Link |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
When you create your project, just start from template "Dynamic Link Library" and it should go through the wizard to set it up correctly for your compiler. I'm not sure what you want me to do - how are my settings going to help when I am using a different compiler to you?
|
5th November 2011, 19:07 | #14 | Link |
Registered User
Join Date: Jan 2006
Posts: 1,867
|
I tried that as well. It creates some sample files for DLL creation which I removed. I then added the project files. Same problem
I'm not sure the compiler matters, I'm hoping it's just the project settings. Simply, are you able to build that source with your setup, and post your .cbp file would be fine. Thanks for your efforts to help |
5th November 2011, 20:09 | #15 | Link | |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
Quote:
Here is my project file (note I am probably using an older version of Code::Blocks). Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <CodeBlocks_project_file> <FileVersion major="1" minor="6" /> <Project> <Option title="Demosaic" /> <Option pch_mode="2" /> <Option compiler="msvctk" /> <Build> <Target title="Release"> <Option output="..\..\bin\Demosaic" prefix_auto="1" extension_auto="1" /> <Option object_output="..\..\obj\Test\" /> <Option type="3" /> <Option compiler="msvctk" /> <Option createDefFile="1" /> <Option createStaticLib="1" /> <Compiler> <Add option="/MD" /> <Add option="/Ox" /> <Add option="/Og" /> <Add option="/W3" /> <Add option="/DBUILD_DLL" /> <Add option="/DNDEBUG" /> <Add directory="C:\Program Files\AviSynth 2.5\FilterSDK\include" /> </Compiler> <Linker> <Add library="avisynth.lib" /> <Add directory="C:\Program Files\AviSynth 2.5\Extras" /> </Linker> </Target> </Build> <Unit filename="demosaic.cpp" /> <Extensions> <code_completion /> <envvars /> <debugger /> <lib_finder disable_auto="1" /> </Extensions> </Project> </CodeBlocks_project_file> Note also the correct settings for compiler include directory and linker libraries. |
|
5th November 2011, 20:35 | #16 | Link | |
Excessively jovial fellow
Join Date: Jun 2004
Location: rude
Posts: 1,100
|
Quote:
I'm also not sure if avisynth.h is even compileable with g++, since it unconditionally does #include <objbase.h> as one of the first things it does. COM stuff isn't exactly known for its portability. Last edited by TheFluff; 5th November 2011 at 20:47. |
|
5th November 2011, 21:10 | #17 | Link |
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
There is some preliminary support for SEH in MinGW. See the macros provided in "excpt.h".
(No idea how well that works in practice)
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ |
5th November 2011, 22:58 | #18 | Link |
Registered User
Join Date: Jan 2006
Posts: 1,867
|
Ya, there was talk of older versions not handling exceptions but I think it's done now.
Thank Gavino, I think I found my problem. First of all, I was wondering where that .lib was officially stored. Next I think there was a problem with spaces in filenames, which is odd, but only relative paths could work. So I got it to work, yay... Hmm, I had some environment variables set for another mingw installation, could that be a conflict? As for MSVC, Avery Lee also goes on about how bad a compiler it is... Visual Studio debugger occasionally locks up the entire Windows GUI http://www.virtualdub.org/blog/pivot/entry.php?id=118 Can I have my VC6 project build back, please? http://www.virtualdub.org/blog/pivot/entry.php?id=111 etc. |
5th November 2011, 23:10 | #19 | Link | |
Excessively jovial fellow
Join Date: Jun 2004
Location: rude
Posts: 1,100
|
Quote:
There are certainly things you can complain about regarding MSVC's code generation, but I don't think it's any significantly better or worse than g++ in general. g++ has the annoying property that if you always stick to the latest version you're quite likely to run into random miscompilation problems that can cause all sorts of bizarre and odd behaviours. Also, using MSVC (the compiler) does not necessarily imply you have to use Visual Studio (the IDE) as well. Usually it's a good idea to do so (VS2010 is probably the least bad C++ IDE; there are no good ones), but you don't have to. Finally, I should mention that there really is no reason to stick to ancient shit like MSVC 2003 either. Visual Studio 2010 Express is a free download which gives you both the compiler and the IDE; the only possibly relevant thing it lacks is the ATL libraries, but those are pretty easy to find elsewhere, and you don't need them for most Avisynth stuff anyway. Last edited by TheFluff; 5th November 2011 at 23:19. |
|
5th November 2011, 23:28 | #20 | Link |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
One thing I noticed with that Demosaic source is that, although using the Avisinth C interface, the source file is actually C++.
When I renamed it to .c instead of .cpp, it failed to compile, as it is using some syntax extensions from C++. Perhaps for your tutorial, you should ensure that your example is pure C. |
Thread Tools | Search this Thread |
Display Modes | |
|
|