What is vstplug.def?

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

I have a question about a specific VST project on github. It is found here...

https://github.com/gijzelaerr/gijzelijzer

I am trying to compile my first vst plugin, and I am using this project as a guide.

My question is simple. What are the files in the resource folder for?

the .rc , .vstxml, and vstplug.def

Post

See this MSDN article.
Resources can be icons, bitmaps, static xml config files and whatever the software needs that is not code which needs compilation.
We are the KVR collective. Resistance is futile. You will be assimilated. Image
My MusicCalc is served over https!!

Post

Specifically, the vstplug.def file exports the entry function for the plugin to have a standardized name, the host can find. Otherwise the plugin probably wont load.

Code: Select all

EXPORTS
    VSTPluginMain
    main=VSTPluginMain

Post

Is this specific to Visual studio projects?

I am building using MingGW and make. Will I have to use makes method for exporting functions in the dll?

Post

Ap0C552 wrote:Is this specific to Visual studio projects?

I am building using MingGW and make. Will I have to use makes method for exporting functions in the dll?
I'm actually not quite sure. The host doesn't care whatever build the DLL as long as it can find the exported function, so you would probably have to ensure it anyway, somehow.

Post

I am confused in regards to the function/class being exported for the dll.

In vstplug.def it says main=VSTPluginMain. But that function or class does not exist anywhere in the project.

View the src here...

https://github.com/gijzelaerr/gijzelijz ... master/src

EDIT: Apparently according to this

http://hans.fugal.net/blog/2006/07/29/v ... n-mingw32/

the .defs file is also accepted by MinGW....

My vst dll is not being regonized by host, and I thought it was because it was no exporting the proper functions...

Post

Its probably the cause. VSTPluginMain is defined in vstsdk2.4/public.sdk/source/vst2.x/vstplugmain.cpp

That function calls createEffectInstance, which you need to defined. Either you haven't included all the necessary source files from the SDK. or you messed up the exported name.

Post

Mayae wrote:Its probably the cause. VSTPluginMain is defined in vstsdk2.4/public.sdk/source/vst2.x/vstplugmain.cpp

That function calls createEffectInstance, which you need to defined. Either you haven't included all the necessary source files from the SDK. or you messed up the exported name.
Is there a way to diagnose for sure that proper fucntions are not being exported?

If I have not included all the neccessary source files, I don't think it would compile successfully, correct?

Also, what do you mean by "exported name"?

This is what my CmakeLists.txt looks like...

Code: Select all

cmake_minimum_required(VERSION 3.4)
project(MyFirstVst)

#install(TARGETS MyFirstVst DESTINATION bin)

#-------------------------------------------------------------------------------
# Find External libs
#-------------------------------------------------------------------------------
SET(VST_DIR C:/VstSDK)
SET(VSTSDK_PLUGIN_SOURCE
    ${VST_DIR}/public.sdk/source/vst2.x/audioeffectx.cpp
    ${VST_DIR}/public.sdk/source/vst2.x/audioeffect.cpp
    ${VST_DIR}/public.sdk/source/vst2.x/vstplugmain.cpp
)

#-------------------------------------------------------------------------------
# Set what to compile how
#-------------------------------------------------------------------------------
SET(MYFIRSTVST_SOURCE
    src/MyFirstVst.cpp
    src/MyFirstVst.h
    src/main.cpp
    resources/myfirstvst.rc
    resources/vstplug.def
    ${VSTSDK_PLUGIN_SOURCE}
)

ADD_LIBRARY(MyFirstVst SHARED ${MYFIRSTVST_SOURCE})

#-------------------------------------------------------------------------------
# Include external libs
#-------------------------------------------------------------------------------
INCLUDE_DIRECTORIES(
    Utility
    ${VST_DIR}
)

Post

To verify your exports, you could use Dependency Walker: http://www.dependencywalker.com/

Post

Dependency Walker just gave errors on any dll and I was not sure how to use it.

Here is what happens when I load Epicverb plug in. Not sure what to make of all this.

Code: Select all

Warning: At least one delay-load dependency module was not found.
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.
Warning: At least one module was corrupted or unrecognizable to Dependency Walker, but still appeared to be a Windows module.
https://www.dropbox.com/s/oggwjzt57haj6 ... r.png?dl=0

I also tried http://www.nirsoft.net/utils/dll_export_viewer.html

When I open a know to be working dll is says exported function name is simply "main".

When I open my dll it says the exact same thing.

Post

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:

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);
}
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.
Last edited by aciddose on Wed Nov 11, 2015 9:46 pm, edited 1 time in total.
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.

Post

I know how to program c++ quite well...

Post

So you understand how to work with compilers, build libraries and so on? That is the important bit. If you don't know how to configure the compiler to export a function in the right format you'lll run into trouble.
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.

Post

aciddose wrote:So you understand how to work with compilers, build libraries and so on? That is the important bit. If you don't know how to configure the compiler to export a function in the right format you'lll run into trouble.
Somewhat. Don't confuse being uncomfortable with foreign build systems, with being new to c++. I have worked for 1.5 year full time as a C++ developer on the Android Platform, in more junior position. If you have trouble building a NativeActivity on Android using the Android NDK build system, I could probably help you. But I have not got much exposure to different build systems like Cmake (this is my first attempt) or building a dll (my first attempt) as well. But my knowledge of the C++ is not beginner. I would like to think intermediate.

To get back on topic. I decided to have cmake output a visual studio sln instead. I built with visual studio, and it built properly. But again did not load in my host.

I get a bunch of warnings though....

Code: Select all

2>LINK : warning LNK4044: unrecognized option '/lkernel32'; ignored
2>LINK : warning LNK4044: unrecognized option '/luser32'; ignored
2>LINK : warning LNK4044: unrecognized option '/lgdi32'; ignored
2>LINK : warning LNK4044: unrecognized option '/lwinspool'; ignored
2>LINK : warning LNK4044: unrecognized option '/lshell32'; ignored
2>LINK : warning LNK4044: unrecognized option '/lole32'; ignored
2>LINK : warning LNK4044: unrecognized option '/loleaut32'; ignored
2>LINK : warning LNK4044: unrecognized option '/luuid'; ignored
2>LINK : warning LNK4044: unrecognized option '/lcomdlg32'; ignored
2>LINK : warning LNK4044: unrecognized option '/ladvapi32'; ignored
Does anyone have a small relaible vsthost they could recommend me. I am loading this vst in my ableton live software. I would like to also be able to try loading in something else, just to be sure there is not come problem that is specific to the host.
Last edited by Ap0C552 on Wed Nov 11, 2015 10:00 pm, edited 1 time in total.

Post

Talk to me in another 13.5 years if you want to talk about what constitutes "beginner".
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.

Post Reply

Return to “DSP and Plugin Development”