Cannot export class symbols

Discussion in 'C++' started by ernesto, Jun 28, 2005.

  1. ernesto

    ernesto Guest

    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
    ernesto, Jun 28, 2005
    #1
    1. Advertising

  2. ernesto wrote:
    > 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
    Victor Bazarov, Jun 28, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?RGF2aWQgVmFsbGU=?=

    Invalid export DLL or export format

    =?Utf-8?B?RGF2aWQgVmFsbGU=?=, Oct 29, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    3,603
    =?Utf-8?B?RGF2aWQgVmFsbGU=?=
    Oct 29, 2003
  2. E11
    Replies:
    1
    Views:
    4,719
    Thomas Weidenfeller
    Oct 12, 2005
  3. ernesto

    Export symbols from .a files

    ernesto, Jul 5, 2005, in forum: C++
    Replies:
    1
    Views:
    333
    Victor Bazarov
    Jul 5, 2005
  4. Maarten Porters
    Replies:
    1
    Views:
    420
    Florian Gilcher
    Jul 28, 2008
  5. John Kelly

    export symbols

    John Kelly, Jun 23, 2010, in forum: Perl Misc
    Replies:
    2
    Views:
    101
    John Kelly
    Jun 23, 2010
Loading...

Share This Page