help-gplusplus
[Top][All Lists]
Advanced

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

Re: Cannot export class symbols


From: Marcelo Slomp
Subject: Re: Cannot export class symbols
Date: Sun, 3 Jul 2005 20:56:05 -0300

"ernesto" <ebasconp@gmail.com> wrote in message 
news:1119826842.138374.114240@f14g2000cwb.googlegroups.com...
> 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
>

use
DLLEXPORT class MyTestClass
instead
class DLLEXPORT MyTestClass




reply via email to

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