Exporting a typedef'd symbol
A 3rd-party DLL I'm compiling contains the following class (in abbreviated form):-
Code:
class __declspec(dllexport) ChordProvider
{
public:
ChordProvider () {} // <--- This gets exported okay
typedef std::map<std::string,Intervals> ChordNameToIntervals;
static ChordNameToIntervals tet12_chords; // <--- tet12_chords doesn't get exported
};
The typedef'd symbol doesn't get exported for some reason. Is that fixable?
[Edit...] I tried a few searches via Google / StackOverflow etc and the consensus seems to be that typedefs are compile time objects which should be accessible from outside the DLL without needing to get exported - but I must admit, that's not what I'm seeing here :confused:
[Update...] Adding this line to the corresponding cpp file fixed the problem :thumb:
Code:
__declspec(dllexport) ChordProvider::ChordNameToIntervals ChordProvider::tet12_chords;
Re: Exporting a typedef'd symbol
The issue is that tet12_chords is static. As you're found, statics need special handling for export.
Re: Exporting a typedef'd symbol
Thanks 2kaud - I haven't used CodeGuru for a while because for a looong time it wasn't sending people emails whenever someone replied to their post but it looks like that might be working again...woohoo!
Re: Exporting a typedef'd symbol
Just to add for clarity: the typedef itself isn't the issue since it's only a compile-time alias. The real point is that `tet12_chords` is a static data member, so it needs an explicit exported definition in the .cpp - exactly like you did.xx
Good catch