MinGW + MSYSでVST Plug-inを作る方法とサンプル。 Freeverb3@sourceforge.netではこれを利用したソースコードをGPLで配布しています。
MSYSはView older releases from the Current packageを開いて表示します。
ライセンスに同意する必要があります。
オプションです。
configure.inでは、AC_LIBTOOL_WIN32_DLLがAM_PROG_LIBTOOLの前に必要です。
LDFLAGS(libtool)には、-no-undefinedが必要です。
MinGWでは、 __declspec(dllexport)マクロによる関数EXPORTをサポートしています。 -fPICは必要ありません。PEはすべてがposition independentです。
mainをエクスポートすることができないコンパイラが多くあります。多くは 以下のようなエラーメッセージを吐いて止まります。
FreeverbMain.cpp:31: error: `main' must return `int' FreeverbMain.cpp:32: error: `main' must return `int' FreeverbMain.cpp: In function `int main(...)': FreeverbMain.cpp:32: error: declaration of C function `int main(...)' conflicts with FreeverbMain.cpp:31: error: previous declaration `AEffect* main(VstIntPtr (*)(AEffect*, VstInt32, VstInt32, VstIntPtr, void*, float))' here FreeverbMain.cpp: In function `int main(...)': FreeverbMain.cpp:32: error: `VSTPluginMain' was not declared in this scope
Windows DLLでは、 同じ関数を別名でDEFファイルによりEXPORTする方法があるのでそれを利用しましょう。
LIBRARY Freeverb4.dll EXPORTS main=VSTPluginMain
EXTRA_DIST = Freeverb4.def lib_LTLIBRARIES = Freeverb4.la DLLDEF = -Wl,$(top_srcdir)/FreeverbVST/Freeverb4.def INCLUDES = \ -I$(top_srcdir)/VST \ -I$(top_srcdir)/Components Freeverb4_la_LDFLAGS = -module -avoid-version -no-undefined \ $(DLLDEF) Freeverb4_la_LIBADD = \ $(top_srcdir)/Components/Components.la \ $(top_srcdir)/VST/VST.la Freeverb4_la_SOURCES = \ Freeverb.cpp \ Freeverb.hpp \ FreeverbMain.cpp
.edata の 0x6aa51000 に export テーブルがあります Export テーブル (.edata セクションの内容を解釈) Export フラグ 0 時刻/日付スタンプ 45d9f339 Major/Minor 0/0 名前 000000000001103c Freeverb4.dll 序数ベース 1 各種の数値: Export アドレステーブル 00000002 [名前ポインタ/序数] テーブル 00000002 テーブルアドレス Export アドレステーブル 0000000000011028 名前ポインタテーブル 0000000000011030 序数テーブル 0000000000011038 Export アドレステーブル -- 序数ベース 1 [ 0] +base[ 1] 19e0 Export RVA [ 1] +base[ 2] 19e0 Export RVA [序数/名前ポインタ] テーブル [ 0] VSTPluginMain [ 1] main
VSTGUIを使用しない例。MSYS上で解凍して、./configure;makeすれば、FreeverbVST/.libsにFreeverb4.dllが 生成されるでしょう。テストした環境は、WindowsXP SP2 / MinGW-5.1.3 / MSYS-1.0.10です。
<Su-Shee> rindolf: yes, I played with Squeak a little and yes I'd like a vim clone written in perl. <Makoryu> Why isn't there one already, then? <Makoryu> (A vim clone in Perl) <Su-Shee> good question. there's one in javascript :) <rindolf> Su-Shee: actually , it's a vi clone. <rindolf> Writing a vi clone is much easier than writing a vim clone. <rindolf> Just like writing a Scheme clone is much easier than writing a Perl 6 implementation. <rindolf> Unless you're Chuck Norris. <Su-Shee> rindolf: darn.. he already wrote a vim in perl6? <moritz_> no, he scared K&R into writing it ;-) <rindolf> Su-Shee: Chuck Norris is the ghost author of the entire Debian GNU/Linux distribution. <rindolf> Su-Shee: and he wrote it in 24 hours, while taking snack breaks. <Su-Shee> rindolf: yes, I know - he published slackware under the pseudonym patrick volkerding... <rindolf> Chuck Norris read the entire Wikipedia. Twice. <araujo> the second time includes fixing all its errors <moritz_> but he didn't commmit his changes, it seems <rindolf> moritz_: heh. <rindolf> LOL. <araujo> Chuck Norris doesn't commit changes, the changes commit for him <araujo> :) <rindolf> Code is too scared of Chuck to be wrong. <rindolf> It is generated right in the first time. <rindolf> Bugs are too afraid to reproduce on Chuck Norris' computer. <Su-Shee> .o(I see a chuck norris release on the horizon... ;) <rindolf> Su-Shee: :-) <Su-Shee> we could ask chuck norris if he's willing to promote the star release.. ;)) (which probably kill the entire internet due to laughter.. :) <araujo> Perl 6 - A Chuck Norris like language <dukeleto> Chuck Norris has actually been using Perl 6 since 1987, and has been waiting for Larry to play catch-up. :) <rindolf> dukeleto: LOL. <rindolf> Perl 6 - Kicks ass like Chuck. <Su-Shee> rakudo - chuck's choice ;) <Su-Shee> well, camelia and chuck norris go well together. ;) <rindolf> OK. <rindolf> Of course everybody know Chuck Norris is a real programmer. <rindolf> He designs machines by combining individual atoms. <rindolf> Using his thought. <rindolf> Atoms obey Chuck Norris. <Su-Shee> rindolf: you obviously have been starved and deprived of super hero comics in your childhood :) -- What you could assume was true about Chuck Norris -- #perl6, Freenode Writing a BitKeeper replacement is probably easier at this point than getting its license changed. Matt Mackall on OFTC.net #offtopic. P.S: Matt Mackall have eventually projected Mercurial, which aims to be a BitKeeper replacement. -- Matt Mackal