Hello, RMS Forum.
I’m evaluating JUCE for use with my employer’s existing software, and am experiencing some problems static linking to the JUCE lib as a project dependency.
The JUCE vcproj is built with the default __cdecl calling convention, and a few functions within the lib are defined as JUCE_CALLTYPE, which is __stdcall for JUCE_MSVC.
So, the JUCE lib is a mixture of mostly __cdecl with some __stdcall mixed in. The __cdecl JUCE functions aren’t declared as __cdecl, they are compiled this way due to a project setting. So, when linking to the JUCE lib, my project doesn’t get __cdecl info from the JUCE headers. It assumes the unspecified function calling conventions are whatever my project’s default calling convention is. This is causing me problems, as my project is build __stdcall for debug and __fastcall for release. (I can’t change this aspect of my project. It’s what I need to deal with, and is out of my hands.) I could change the JUCE project default to match my project’s, but the JUCE lib doesn’t successfully build if the project’s calling convention isn’t set to __cdecl.
It’s my understanding that the common practice for libraries is to specify the calling convention for all function prototypes so that they can be called from other libs without making calling convention assumptions.
Am I missing something with JUCE? Is there a calling convention switch I should be using? Multiple lib flavors?
I expect,as usual, I’m missing something rather simple.
Here are my link errors.
My project is building jucelib_static_Win32_debug.lib as a dependency and static linking to it.
Any help understanding this would be much appreciated.
3>JuceAudioEngine.obj : error LNK2019: unresolved external symbol "public: static unsigned int __stdcall juce::Time::getMillisecondCounter(void)" (?getMillisecondCounter@Time@juce@@SGIXZ) referenced in function "public: virtual void __thiscall TestTimer::timerCallback(void)" (?timerCallback@TestTimer@@UAEXXZ)
3>JuceAudioEngine.obj : error LNK2019: unresolved external symbol "public: static class juce::MidiMessage const __stdcall juce::MidiMessage::noteOff(int,int)" (?noteOff@MidiMessage@juce@@SG?BV12@HH@Z) referenced in function "public: virtual void __thiscall TestTimer::timerCallback(void)" (?timerCallback@TestTimer@@UAEXXZ)
3>JuceAudioEngine.obj : error LNK2019: unresolved external symbol "public: static class juce::MidiMessage const __stdcall juce::MidiMessage::noteOn(int,int,unsigned char)" (?noteOn@MidiMessage@juce@@SG?BV12@HHE@Z) referenced in function "public: virtual void __thiscall TestTimer::timerCallback(void)" (?timerCallback@TestTimer@@UAEXXZ)
3>JuceAudioEngine.obj : error LNK2019: unresolved external symbol "public: static void __stdcall juce::Process::setPriority(enum juce::Process::ProcessPriority)" (?setPriority@Process@juce@@SGXW4ProcessPriority@12@@Z) referenced in function "private: __thiscall JuceAudioEngine::JuceAudioEngine(void)" (??0JuceAudioEngine@@AAE@XZ)
3>JuceAudioEngine.obj : error LNK2019: unresolved external symbol "public: static void __stdcall juce::JUCEApplication::quit(void)" (?quit@JUCEApplication@juce@@SGXXZ) referenced in function "public: bool __thiscall JuceAudioEngine::tryToQuitApplication(void)" (?tryToQuitApplication@JuceAudioEngine@@QAE_NXZ)
3>JuceAudioEngine.obj : error LNK2019: unresolved external symbol "public: static int __stdcall juce::DialogWindow::showModalDialog(class juce::String const &,class juce::Component *,class juce::Component *,class juce::Colour const &,bool,bool,bool)" (?showModalDialog@DialogWindow@juce@@SGHABVString@2@PAVComponent@2@1ABVColour@2@_N33@Z) referenced in function "private: void __thiscall JuceAudioEngine::showAudioSettings(void)" (?showAudioSettings@JuceAudioEngine@@AAEXXZ)
3>JuceFilterGraph.obj : error LNK2019: unresolved external symbol "public: static class juce::String const __stdcall juce::LocalisedStrings::translateWithCurrentMappings(char const *)" (?translateWithCurrentMappings@LocalisedStrings@juce@@SG?BVString@2@PBD@Z) referenced in function "public: unsigned int __thiscall JuceFilterGraph::addFilter(class juce::PluginDescription const *)" (?addFilter@JuceFilterGraph@@QAEIPBVPluginDescription@juce@@@Z)
3>JuceGraphDocument.obj : error LNK2019: unresolved external symbol "public: static class juce::Random & __stdcall juce::Random::getSystemRandom(void)" (?getSystemRandom@Random@juce@@SGAAV12@XZ) referenced in function "private: __thiscall PluginWindow::PluginWindow(class juce::Component * const,class juce::AudioProcessorGraph::Node *,bool)" (??0PluginWindow@@AAE@QAVComponent@juce@@PAVNode@AudioProcessorGraph@2@_N@Z)
Many thanks,
Xi G.