help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Cannot export class symbols


From: ernesto
Subject: Cannot export class symbols
Date: 26 Jun 2005 16:00:42 -0700
User-agent: G2/0.2

Hi everybody:


I am writing this very small test program 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 main.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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]