Sign in to follow this  
mikeman

Dev-CPP: exporting symbols problem

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 this post


Link to post
Share on other sites
Quote:
Original post by garyfletcher
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?


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 this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this