Cannot export class symbols

E

ernesto

Hi everybody:


I am writing this very small test class using g++ and mingw:

#ifdef DLL
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT __declspec(dllimport)
#endif


#include <stdio.h>


class DLLEXPORT MyTestClass
{
public:
MyTestClass() { }
~MyTestClass() { }
int GetSuccessor(int a) { return a + 1; }
int GetPredecessor(int a) { return a - 1; }



};


As you can see, I want to export that class into a DLL.
So, I do:

g++ -shared -o test.dll test.cpp -Wl,-output-def=test.def -DDLL


and my DLL is an empty DLL with no exported symbols!!! (and the .def
file has length 0).


Am I doing something wrong? I am creating a C++ library, so, I want to
export only classes into my DLL.


Thanks in advance


Ernesto
 
V

Victor Bazarov

ernesto said:
I am writing this very small test class using g++ and mingw:

#ifdef DLL
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT __declspec(dllimport)
#endif

[...]

These things are not standard C++. Please ask in a newsgroup for
your compiler since compiler-specific extensions are OT here. Thanks.

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top