I would like to say that I am trying very hard here to achieve something, and you knocking me down a peg is actually somewhat disheartening.aciddose wrote:Talk to me in another 13.5 years if you want to talk about what constitutes "beginner".
What is vstplug.def?
-
- KVRist
- Topic Starter
- 154 posts since 15 Feb, 2012
-
- KVRian
- 573 posts since 1 Jan, 2013 from Denmark
Don't you have any tools from visual studio? dumpbin is a very useful tool, the /exports function tells you what functions are exported and what their names are:
yields
Code: Select all
>dumpbin /exports signalizer.dll
Code: Select all
Dump of file signalizer.dll
File Type: DLL
Section contains the following exports for Signalizer.dll
00000000 characteristics
5643B93E time date stamp Wed Nov 11 22:55:10 2015
0.00 version
1 ordinal base
2 number of functions
2 number of names
ordinal hint RVA name
1 0 00240880 VSTPluginMain = _VSTPluginMain
2 1 00240870 main = _main
Summary
15000 .data
1DA000 .rdata
23000 .reloc
1000 .rsrc
25E000 .text
1000 .tls
2000 _RDATA
-
- KVRist
- Topic Starter
- 154 posts since 15 Feb, 2012
This is weird, but none of my plugins dumpbin resembles yours.
Here is the output of 3 dumpbin. Two known working plugins, EpicVerb, and Phase90, and my plugin libMyFirstVst.
They all give the same name of their single exported function.
Here is the output of 3 dumpbin. Two known working plugins, EpicVerb, and Phase90, and my plugin libMyFirstVst.
They all give the same name of their single exported function.
Code: Select all
C:\Program Files\Steinberg\VstPlugins>dumpbin /exports epicverb.dll
Microsoft (R) COFF/PE Dumper Version 12.00.31101.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file epicverb.dll
File Type: DLL
Section contains the following exports for VST.dll
00000000 characteristics
4B14231A time date stamp Mon Nov 30 13:55:06 2009
0.00 version
1 ordinal base
1 number of functions
1 number of names
ordinal hint RVA name
1 0 00004780 main
Summary
2000 .rsrc
3B7000 UPX0
101000 UPX1
C:\Program Files\Steinberg\VstPlugins>dumpbin /exports phase90.dll
Microsoft (R) COFF/PE Dumper Version 12.00.31101.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file phase90.dll
File Type: DLL
Section contains the following exports for PHASE90.dll
00000000 characteristics
4060136B time date stamp Tue Mar 23 05:37:31 2004
0.00 version
1 ordinal base
1 number of functions
1 number of names
ordinal hint RVA name
1 0 00002000 main
Summary
1B000 UPX0
F000 UPX1
1000 UPX2
C:\Program Files\Steinberg\VstPlugins>dumpbin /exports libMyFirstVst.dll
Microsoft (R) COFF/PE Dumper Version 12.00.31101.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file libMyFirstVst.dll
File Type: DLL
Section contains the following exports for again.dll
00000000 characteristics
5643B3E5 time date stamp Wed Nov 11 15:32:21 2015
0.00 version
1 ordinal base
1 number of functions
1 number of names
ordinal hint RVA name
1 0 000012EE main
Summary
1000 .data
1000 .idata
2000 .rdata
1000 .reloc
1000 .rsrc
6000 .text
C:\Program Files\Steinberg\VstPlugins>
- KVRAF
- 12555 posts since 7 Dec, 2004
In my opinion you will see the most benefit if you knock yourself down a peg and realize you need to start at the beginning.Ap0C552 wrote:I would like to say that I am trying very hard here to achieve something, and you knocking me down a peg is actually somewhat disheartening.
You're framing this whole issue in terms of "I've followed the steps, there is an error". There has been no error other than that the steps you've attempted to follow were wrong to begin with. Do not jump to conclusions without starting from step #1.
Start at the beginning, get the proper functions exported as I demonstrated in my previous post.
Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.
- KVRAF
- 12555 posts since 7 Dec, 2004
If you want a simple VST host, write your own:
Code: Select all
vstptr __cdecl vsthostcallback(AEffect *effect, vst32 opcode, vst32 index, vstptr value, void *ptr, float opt)
{
switch (opcode) {
}
}
HMODULE plugin = LoadLibrary(path);
typedef AEffect*(*vstmainfunc)(audioMasterCallback audioMaster);
vstmainfunc plugin_main = 0;
plugin_main = GetProcAddress(plugin, "VSTPluginMain");
if (!plugin_main) {
plugin_main = GetProcAddress(plugin, "main");
}
if (plugin_main) {
typedef vstptr __cdecl (*audioMasterCallback)(AEffect *effect, vst32 opcode, vst32 index, vstptr value, void *ptr, float opt);
audioMasterCallback host_callback = &vsthostcallback;
AEffect *audioeffect = plugin_main(host_callback);
// ...
}
Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.
-
- KVRist
- Topic Starter
- 154 posts since 15 Feb, 2012
Where are you suggesting I put that code?aciddose wrote:Don't use a VST plug-in to learn basic c/c++ and programming.
It sounds to me like you're having a lot of trouble on the compiler side. Likely with linkage and linkage options.
.def files are a visual studio way to pass linker commands as a file. You can actually do the same using the right compiler-specific pragma statements in the source, and by prototyping your functions correctly.
This sort of thing will also work:As far as I'm aware this works the same way as the source containing the exports from the "VST SDK", only it doesn't write an alternate name using the linker but rather exports a duplicate function body.Code: Select all
vst::AEffect *getVst(vst::audioMasterCallback audioMaster); #if defined(_WIN32) #define EXPORT extern "C" __declspec(dllexport) #else #define EXPORT extern "C" #endif EXPORT vst::AEffect *MAIN(vst::audioMasterCallback audioMaster) { return getVst(audioMaster); } EXPORT vst::AEffect *VSTPluginMain(vst::audioMasterCallback audioMaster) { return getVst(audioMaster); }
-
- KVRian
- 573 posts since 1 Jan, 2013 from Denmark
They all export main, which should be ok. Attach a debugger to a host, set a breakpoint on your main function (VSTPluginMain), load your plugin and step through it?Ap0C552 wrote:This is weird, but none of my plugins dumpbin resembles yours.
Here is the output of 3 dumpbin. Two known working plugins, EpicVerb, and Phase90, and my plugin libMyFirstVst.
They all give the same name of their single exported function.
Code: Select all
C:\Program Files\Steinberg\VstPlugins>dumpbin /exports epicverb.dll Microsoft (R) COFF/PE Dumper Version 12.00.31101.0 Copyright (C) Microsoft Corporation. All rights reserved. Dump of file epicverb.dll File Type: DLL Section contains the following exports for VST.dll 00000000 characteristics 4B14231A time date stamp Mon Nov 30 13:55:06 2009 0.00 version 1 ordinal base 1 number of functions 1 number of names ordinal hint RVA name 1 0 00004780 main Summary 2000 .rsrc 3B7000 UPX0 101000 UPX1 C:\Program Files\Steinberg\VstPlugins>dumpbin /exports phase90.dll Microsoft (R) COFF/PE Dumper Version 12.00.31101.0 Copyright (C) Microsoft Corporation. All rights reserved. Dump of file phase90.dll File Type: DLL Section contains the following exports for PHASE90.dll 00000000 characteristics 4060136B time date stamp Tue Mar 23 05:37:31 2004 0.00 version 1 ordinal base 1 number of functions 1 number of names ordinal hint RVA name 1 0 00002000 main Summary 1B000 UPX0 F000 UPX1 1000 UPX2 C:\Program Files\Steinberg\VstPlugins>dumpbin /exports libMyFirstVst.dll Microsoft (R) COFF/PE Dumper Version 12.00.31101.0 Copyright (C) Microsoft Corporation. All rights reserved. Dump of file libMyFirstVst.dll File Type: DLL Section contains the following exports for again.dll 00000000 characteristics 5643B3E5 time date stamp Wed Nov 11 15:32:21 2015 0.00 version 1 ordinal base 1 number of functions 1 number of names ordinal hint RVA name 1 0 000012EE main Summary 1000 .data 1000 .idata 2000 .rdata 1000 .reloc 1000 .rsrc 6000 .text C:\Program Files\Steinberg\VstPlugins>
- KVRAF
- 12555 posts since 7 Dec, 2004
I'm not interested in hand-holding.Ap0C552 wrote:Where are you suggesting I put that code?
... although I could come up with a suggestion or two.
Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.
-
- KVRist
- Topic Starter
- 154 posts since 15 Feb, 2012
So you are suggesting to put a breakpoint in the Vstsdk source file vstpluginmain.cpp?
- KVRAF
- 12555 posts since 7 Dec, 2004
"Wah! I think I deserve service! Everyone ought to do my work for me because it isn't fair if I have to!"
Again, start at the beginning:
How to export a function from a dll: (applies to any library, .exe, .so or whatever other format on whatever OS. This is part of C/C++ standards.)
https://msdn.microsoft.com/en-us/library/z4zxe9k8.aspx
How to debug with GDB:
http://www.thegeekstuff.com/2010/03/deb ... using-gdb/
GDB is not advised. Try using Visual Studio instead, it is far easier to use. Modern versions of MSVC have flags which improve the compiler's obedience of standards, which means you can in some cases hope to produce code compatible with compilers like g++/gcc. That said, while using MSVC ensure that you also use GCC with minGW or similar to proof your code.
How to debug in Visual Studio:
http://www.codeproject.com/Articles/795 ... o-A-Beginn
Again, start at the beginning:
How to export a function from a dll: (applies to any library, .exe, .so or whatever other format on whatever OS. This is part of C/C++ standards.)
https://msdn.microsoft.com/en-us/library/z4zxe9k8.aspx
How to debug with GDB:
http://www.thegeekstuff.com/2010/03/deb ... using-gdb/
GDB is not advised. Try using Visual Studio instead, it is far easier to use. Modern versions of MSVC have flags which improve the compiler's obedience of standards, which means you can in some cases hope to produce code compatible with compilers like g++/gcc. That said, while using MSVC ensure that you also use GCC with minGW or similar to proof your code.
How to debug in Visual Studio:
http://www.codeproject.com/Articles/795 ... o-A-Beginn
Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.
- KVRAF
- 12555 posts since 7 Dec, 2004
I have another recommendation that you may not find mentioned by others:
http://forum.xhip.net/viewtopic.php?f=5&t=9
This style of debugging is not at all the same as generic utilization of "assert()". What I recommend is instead not something you should include in release versions, even during beta testing. It is something you should include while debugging to make debugging easy.
My use of "ASSERT()" is different from "assert()". The c macro is simply a method to break during debugging on any code which fails a "sanity check". All the typical objections to "assert()" such as recommendations to use c++ exception handling can be applied with "ASSERT()", they are not mutually exclusive.
This is much, much higher level stuff. Consider this after you've mastered linkage, exports and debugging.
http://forum.xhip.net/viewtopic.php?f=5&t=9
This style of debugging is not at all the same as generic utilization of "assert()". What I recommend is instead not something you should include in release versions, even during beta testing. It is something you should include while debugging to make debugging easy.
My use of "ASSERT()" is different from "assert()". The c macro is simply a method to break during debugging on any code which fails a "sanity check". All the typical objections to "assert()" such as recommendations to use c++ exception handling can be applied with "ASSERT()", they are not mutually exclusive.
This is much, much higher level stuff. Consider this after you've mastered linkage, exports and debugging.
Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.
- KVRAF
- 12555 posts since 7 Dec, 2004
Another couple links that you should find very helpful:
Blog post on basics of C and C++ linkage:
http://www.embedded.com/design/prototyp ... n-C-and-C-
How to master the art of research:
https://google.com
Blog post on basics of C and C++ linkage:
http://www.embedded.com/design/prototyp ... n-C-and-C-
How to master the art of research:
https://google.com
Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.
- KVRAF
- 12555 posts since 7 Dec, 2004
Sorry, after checking the linkage article it seems it didn't ever mention calling convention or name-mangling.
Calling conventions:
http://www.codeproject.com/Articles/138 ... emystified
Name mangling and extern "C":
http://www.geeksforgeeks.org/extern-c-in-c/
Again, these are just some quick results I picked out. Google is your friend.
Calling conventions:
http://www.codeproject.com/Articles/138 ... emystified
Name mangling and extern "C":
http://www.geeksforgeeks.org/extern-c-in-c/
Again, these are just some quick results I picked out. Google is your friend.
Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.
- KVRAF
- 12555 posts since 7 Dec, 2004
... And furthermore, you claim you know what you're dealing with. If so, why are you here?
What you've said so far, the questions you've asked make it seem as if you have absolutely no idea what you're doing and zero experience with C/C++ or compilers.
Compilers and the specific flags or configuration that go with them are one thing. You complained that what I said about your knowledge of C++ appeared to refer to compiler flags. It did not.
What I was referring to is a knowledge of fundamental rules of the language which apply to all compilers. This stuff is part of the code itself. The compiler configuration and flags passed to it may influence how certain parts of your code are interpreted, but the rules governing what is interpreted and what it means according to the standards of the language are very basic, essential things you need to know to use any compiler on any OS or configuration.
You ask above where the code I gave as example should go. I can not tell you this.
Here is a list of places it might fit:
If you'd said "I have no idea what the code is trying to do or how I should use it, can you explain it or add some comments please?" I may have been willing to do some hand-holding, which is actually what I'm doing right now.
For you to snap back with "I know what I'm doing, don't assume I don't know" and then expect hand-holding is foolish. If you know what you're doing, you'll be expected to handle this basic stuff on your own.
You've also asked whether you should add a break-point on a particular function. No you should not add the breakpoint to VSTPluginMain(). The function we're interested in is main(). Find where this function is defined or which compiler configuration automatically defines it and either fix it (if it is not the function expected by the VST interface) or break there to try to identify what the issue is with returning the expected aeffect pointer from there.
VST is a C interface. This means it requires some basic knowledge of C as well as C++, especially so how the two interact with one another. You can't write the VST interface using C++, it isn't possible, period. It requires a significant amount of effort to correctly define the function prototypes and structures (POD) as C, without name-mangling or padding that occurs in C++.
What you've said so far, the questions you've asked make it seem as if you have absolutely no idea what you're doing and zero experience with C/C++ or compilers.
Compilers and the specific flags or configuration that go with them are one thing. You complained that what I said about your knowledge of C++ appeared to refer to compiler flags. It did not.
What I was referring to is a knowledge of fundamental rules of the language which apply to all compilers. This stuff is part of the code itself. The compiler configuration and flags passed to it may influence how certain parts of your code are interpreted, but the rules governing what is interpreted and what it means according to the standards of the language are very basic, essential things you need to know to use any compiler on any OS or configuration.
You ask above where the code I gave as example should go. I can not tell you this.
Here is a list of places it might fit:
- In a source file
- In your nose
If you'd said "I have no idea what the code is trying to do or how I should use it, can you explain it or add some comments please?" I may have been willing to do some hand-holding, which is actually what I'm doing right now.
For you to snap back with "I know what I'm doing, don't assume I don't know" and then expect hand-holding is foolish. If you know what you're doing, you'll be expected to handle this basic stuff on your own.
You've also asked whether you should add a break-point on a particular function. No you should not add the breakpoint to VSTPluginMain(). The function we're interested in is main(). Find where this function is defined or which compiler configuration automatically defines it and either fix it (if it is not the function expected by the VST interface) or break there to try to identify what the issue is with returning the expected aeffect pointer from there.
VST is a C interface. This means it requires some basic knowledge of C as well as C++, especially so how the two interact with one another. You can't write the VST interface using C++, it isn't possible, period. It requires a significant amount of effort to correctly define the function prototypes and structures (POD) as C, without name-mangling or padding that occurs in C++.
Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.
-
- KVRist
- Topic Starter
- 154 posts since 15 Feb, 2012
I wrote my own program to load vsts. When I loaded mine I got a system error saying missing dll libgcc_s_dw2-1.dll.
I had fixed this before by adding compile flags -static-libgcc -static-libstdc++.
But when I used this example project that uses cmake, I forgot to add these flags back in.
Turns out Ableton and the VstHostx86 were eating this error, so I had nothing to remind me.
I had fixed this before by adding compile flags -static-libgcc -static-libstdc++.
But when I used this example project that uses cmake, I forgot to add these flags back in.
Turns out Ableton and the VstHostx86 were eating this error, so I had nothing to remind me.