Author Topic: build new dll from the example  (Read 7428 times)

yanfog

  • Newbie
  • *
  • Posts: 5
    • View Profile
build new dll from the example
« on: November 29, 2008, 13:58:08 »
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

  • Administrator
  • Sr. Member
  • *****
  • Posts: 273
    • View Profile
Re: build new dll from the example
« Reply #1 on: November 30, 2008, 11:08:52 »
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

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: build new dll from the example
« Reply #2 on: December 07, 2008, 20:26:20 »
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

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: build new dll from the example
« Reply #3 on: December 10, 2008, 22:50:46 »
ok, i figure it out... i add thoes miss files to my project...