JUCE_API is not set to __declspec(dllexport) when creating Dynamic Library project


#1

Hi all
I am creating a Dynamic-Library project, but the JUCE API macro in not set to the appropriate value __declspec(dllexport).
Am I missing something?

Thanks in advance

George

EDIT : As I see, this issue arises up because the JUCE_DLL_BUILD macro, is also not defined.

EDIT_2 : Ok, I put the definition “#define JUCE_DLL_BUILD 1” in the Preprocessor Definitions’s place inside the Visual Studio exporter’s properties.
After that It seems to work fine but I am troubled if this is the right way .


#2

I was hurried to speak up. Thousands of fatal error. . .
Oh… I have spent two days searching for what about goes wrong and I can’t extract DLL functions.
I found that JUCE_API, does not set up properly(?) as its documentation says.
Well, I’ll try to use an other way to have the appropriate results.
Anyway, any help is very appreciated…

George


#3

To me, it seems that there is a bug in the Projucer, as it should define JUCE_DLL_BUILD=1 when creating a Dynamic Library project. Adding “JUCE_DLL_BUILD=1” in the “Extra Preprocessor Definitions” of the Visual Studio exporter is indeed the best workaround.

When building the code that uses the Dynamic Library, you have to make sure that JUCE_DLL is defined, but not JUCE_DLL_BUILD.

I hope this helps.


#4

The “JUCE_DLL_BUILD=1” seems to work fine when the DLL project is built.
But in the client program, when I add JUCE_DLL=1 to the Extra Preprocessor Definitions of the Visual Studio exporter, I am getting thousands of C4273 warnings (inconsistent dll linkage).
I thing this warning is produced for every JUCE class and/or function which are included to the project.

So, I am staying to search for the proper solution.


#5

Could you upload the two .jucer files that you are using? (the one of the Dynamic Library and the one of the client program). It would help me understand the situation.


#6

The client program probably works properly, without having define the JUCE_DLL macto in the Extra Preprocessor Definitions. As I said, If I define it, I get thousands of warnings.

The two .jucer files:
AudioFiltersGroup01.jucer.txt (5.1 KB)
UseOfDLL.jucer.txt (6.0 KB)


#7

The GUI Application “UseOfDLL” has the JUCE classes twice:

  • once from the Dynamic Library “AudioFiltersGroup01”
  • and once from itself

Indeed, “UseOfDLL” is building 10 JUCE modules on its own, which is even more than what “AudioFiltersGroup01” provides. If you really want to build a Dynamic Library and then use it in client projects, you have to delete all JUCE modules from the client projects that are already provided by the Dynamic Library.


#8

Ok, This is the most important fundamental issue when implementing Shared libraries.
Thanks a lot for your help. .