# Dev-CPP: exporting symbols problem

This topic is 4905 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I'm going to make this quick. Consider the following code from a .dll project: calmixer.h:
class __declspec(dllexport) CalMixer
{
...
void foo();
...
};


calmodel.h:
class CalMixer;//forward declaration

class __declspec(dllexport) CalModel
{
....
CalMixer *mixer;
...
}


calmixer.cpp:
#include "calmixer.h"
#include "calmodel.h"

void CalMixer::foo()
{

}


I want to export the function CalMixer::foo(), but that doesn't happen, although the CalMixer class is declared with __declspec(dllexport). The reason for that is that, in "calmodel.h" it is declared as a forward decl as "class CalMixer", and in calmixer.cpp, "calmodel.h" comes after "calmixer.h". I know this isn't the best setup, but it's not mine, and let's say I can't change it. It seems like the second, forward declaration is "overriding" the first one. If I change the forward declaration to "class __declspec(dllexport) CalMixer;", then it exports the function, but let's say I can't do that either. What I want to know is, is there any compiler or liker parameter or whatever that I can set so that the forward declaration doesn't override the first?

##### Share on other sites
In calmodel.h can you not include calmixer.h or can you add the forward declaration of CalMixer as a private member of the CalModel class?

##### Share on other sites
Quote:
 Original post by garyfletcherIn calmodel.h can you not include calmixer.h or can you add the forward declaration of CalMixer as a private member of the CalModel class?

As I said, consider the setup as is. I haven't the luxury of editing each file where this happens(and they are a lot), or let's just say I want that to be my very last option. Any quicker way?

##### Share on other sites
Okay...how about amending the makefile so that it changes the order of compilation?

##### Share on other sites
Well...that's not very nice.

Anyway...hope you got it working..:)

1. 1
2. 2
Rutin
16
3. 3
4. 4
5. 5

• 26
• 11
• 9
• 9
• 11
• ### Forum Statistics

• Total Topics
633702
• Total Posts
3013451
×