Question about shared library (DLL) export & import

Discussion in 'C++' started by Allen, Feb 2, 2007.

  1. Allen

    Allen Guest

    I write 3 classes:

    class CRPCParaPacker
    {
    private:
    CRPCInParaPacker inPack;
    CRPCOutParaPacker outPack;
    };

    I want to export only CRPCParaPacker class. So in the header file of
    CRPCParaPacker, I use
    #ifdef WIN32
    #ifdef RPCPACKER_EXPORTS
    #define RPCPACKER_API __declspec(dllexport)
    #else
    #define RPCPACKER_API __declspec(dllimport)
    #endif

    #ifndef RPCPACKER_EXPORTS
    #pragma comment(lib, "RPCPacker.lib")
    #pragma message("Automatically linking with RPCPacker.dll")
    #endif
    #pragma warning(disable : 4251)
    #endif

    class CRPCInParaPacker;
    class CRPCOutParaPacker;

    class RPCPACKER_EXPORTS CRPCParaPacker
    {
    private:
    CRPCInParaPacker inPack;
    CRPCOutParaPacker outPack;
    };

    Class CRPCInParaPacker and CRPCOutParaPacker are not exported.

    When compile above classes into DLL, it is ok.
    But when used in other application, it is compiled with errors:

    rpcparapacker.h(190) : error C2079: "CRPCParaPacker::inPacker" uses
    undefined class"CRPCInParaPacker"
    rpcparapacker.h(190) : error C2079: "CRPCParaPacker::eek:utPacker" uses
    undefined class"CRPCOutParaPacker"

    Why?
    Allen, Feb 2, 2007
    #1
    1. Advertising

  2. Allen

    Ian Collins Guest

    Allen wrote:
    > I write 3 classes:
    >
    > class CRPCParaPacker
    > {
    > private:
    > CRPCInParaPacker inPack;
    > CRPCOutParaPacker outPack;
    > };
    >
    > I want to export only CRPCParaPacker class. So in the header file of
    > CRPCParaPacker, I use
    > #ifdef WIN32


    You've come to the wrong place, try a windows group.

    --
    Ian Collins.
    Ian Collins, Feb 2, 2007
    #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. plb
    Replies:
    0
    Views:
    374
  3. plb
    Replies:
    0
    Views:
    310
  4. Replies:
    1
    Views:
    1,256
    santosh
    Jul 15, 2008
  5. DJ Stunks
    Replies:
    0
    Views:
    316
    DJ Stunks
    Feb 10, 2007
Loading...

Share This Page