Development Topics > Plugin Development

build new dll from the example

(1/1)

yanfog:
hi,
i download the PercussionOnsetDetector example source code-  and build it to dll.
when i put it in the C:\Program Files\Vamp Plugins folder, the sonic-visualiser didn't recognize it.
what did i do wrong?
thanks.

cannam:
Hello!

Two possible lines of enquiry:

1. No plugin entry point?

Did you compile _just_ the PercussionOnsetDetector.cpp file into the DLL?

A Vamp plugin library also requires a public entry point which is a C function that lists the plugins that are available in the library.  In the example plugin set, this is provided by the file plugins.cpp -- you will need to compile either this file, or a similar one produced by cut-and-paste but listing only the PercussionOnsetDetector and not the rest of the example plugins, into your DLL as well.

2. Plugin entry point is not public in the DLL?

If you are building using Visual Studio, then the default for the VS linker is to make all symbols in the DLL hidden, which means the host will not be able to find the appropriate entry point when it looks at the plugin library.

You need to change this so that the single entry point (vampGetPluginDescriptor in the plugins.cpp file) is made public in the DLL.  Windows-specific code often does this with a __declspec(dllexport) attribute before the function declaration in the code, but this does leave you with less portable code.  Another way that I think is preferable is to add the linker option /EXPORT:vampGetPluginDescriptor to the project.

The next release of the SDK (due shortly) will be clearer about this in the documentation -- the current version does not really have any documentation specific to Visual Studio (which is the only major compiler/linker for which this is an issue -- the OS/X linker and the GNU linker on Linux both make symbols public by default).  It will also include an example project with this option set appropriately.

Hope this helps!


Chris

yanfog:
thanks for your help,
i add this code to the PercussionOnsetDetector.cpp

static Vamp::PluginAdapter<PercussionOnsetDetector> percussionOnsetAdapter;

const VampPluginDescriptor *vampGetPluginDescriptor(unsigned int version,
                                                    unsigned int index)
{
   return percussionOnsetAdapter.getDescriptor(); 
}

and now i get:
PercussionOnsetDetector.obj : error LNK2001: unresolved external symbol "protected: __thiscall Vamp::PluginAdapterBase::PluginAdapterBase(void)" (??0PluginAdapterBase@Vamp@@IAE@XZ)
1>PercussionOnsetDetector.obj : error LNK2001: unresolved external symbol "public: struct _VampPluginDescriptor const * __thiscall Vamp::PluginAdapterBase::getDescriptor(void)" (?getDescriptor@PluginAdapterBase@Vamp@@QAEPBU_VampPluginDescriptor@@XZ)
1>PercussionOnsetDetector.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall Vamp::PluginAdapterBase::~PluginAdapterBase(void)" (??1PluginAdapterBase@Vamp@@UAE@XZ)

have any idea why ?
yaniv

yanfog:
ok, i figure it out... i add thoes miss files to my project...

Navigation

[0] Message Index

Go to full version