Example of using "windows dll"?


#1

Hi,

I am looking for an example project of using “windows dll” provided in JUCE 2.0 release. I tried to set up a Visual Studio 2008 solution with a C++ console application project and added “windows dll” project to the solution. Below is the main source code:

void playTestSound()
{
	AudioDeviceManager deviceManager;
    deviceManager.initialise(255,255,NULL, true);
    deviceManager.playTestSound();
    Thread::sleep(5000);
}

//==============================================================================
int main (int argc, char* argv[])
{
	ScopedJuceInitialiser_GUI plattform;
	playTestSound();
    return 0;
}

And linker gave out following errors:
[list]
Error 1 error LNK2001: unresolved external symbol “public: static class juce::String const juce::String::empty” (?empty@String@juce@@2V12@B) Main.obj MyTest
Error 2 error LNK2001: unresolved external symbol “private: static class juce::JUCEApplicationBase * juce::JUCEApplicationBase::appInstance” (?appInstance@JUCEApplicationBase@juce@@0PAV12@A) Main.obj MyTest
Error 3 error LNK2001: unresolved external symbol “public: static class juce::JUCEApplicationBase * (__cdecl* juce::JUCEApplicationBase::createInstance)(void)” (?createInstance@JUCEApplicationBase@juce@@2P6APAV12@XZA) Main.obj MyTest
Error 4 error LNK2001: unresolved external symbol “public: static class juce::ModalComponentManager * juce::ModalComponentManager::_singletonInstance” (?_singletonInstance@ModalComponentManager@juce@@2PAV12@A) Main.obj MyTest
Error 5 error LNK2001: unresolved external symbol “public: static class juce::AudioPluginFormatManager * juce::AudioPluginFormatManager::_singletonInstance” (?_singletonInstance@AudioPluginFormatManager@juce@@2PAV12@A) Main.obj MyTest
[/list]

How to resolve the above errors?

Thanks.


#2

I managed to get rid of all the errors except this one:
[list]
Error 1 error LNK2001: unresolved external symbol “public: static class juce::String const juce::String::empty” (?empty@String@juce@@2V12@B) Main.obj MyTest
[/list]

The “empty” is a const of String class. It is declared in juce_String.h and defined in juce_String.cpp. If using static link, everything is fine; but if using DLL, then linker generates the above error.

Any idea of how to fix this error?

Thanks.


#3

Do you fixed this errror,i just got this trouble,if you fixed it,please tell me.thanks.


#4

You need to define JUCE_DLL preprocessor in your project.