I have a statically linked library, which I'd like to convert to dynamically linked one. For that I'd have to export symbols. My question is what symbols should I export in case of the interfaces. Here is an example

// ----- IA.h
// Interface class
class IA{
static IA* m_Singleton;
void int b() = 0;

#if defined(NONCLIENT_BUILD)
	#define EXPORT __declspec(dllexport)
	#define EXPORT __declspec(dllimport)

// Function that instantiates implementation of IA
EXPORT boost::shared_ptr<IA> CreateA();
// ----- a.cpp, which will be in a.dll
class A: public IA {
void int b() {return 1;}
// Implementation of the function for instantiation
EXPORT boost::shared_ptr<IA> CreateA(){return boost::shared_ptr<IA>(new A);}
// Should this be exported as well?
IA* IA:m_Singleton = NULL;
// ----- main.h
#include "IA.h"
main(int argc, char *argv[])
boost::shared_ptr<IA> a = CrateA();
return IA:m_Singleton->b();

As for me the only thing from a.dll is CreateA(), hence I think I need to export only that function. This means that I do not need to export IA class. Am I thinking correctly?

The next question is, what should I do if IA if I have static member IA*. Where should I instantiate the singleton? Should it be exported?

Thank you.

9 Years
Discussion Span
Last Post by Ancient Dragon

you can export the entire class. I don't know if you can export boost library classes like this or not:

_dllspec(_dllexport) class A
// blabla
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.