Question about shared library (DLL) export & import



 DEVELOP > c-Plus-Plus > Question about shared library (DLL) export & import

LINK TO THIS PAGE  


rating :  0   |  0


  Page 1 of 1

1

 
Topic: DEVELOP > c-Plus-Plus
User: "Allen"
Date: 01 Feb 2007 08:20:12 PM
Object: Question about shared library (DLL) export & import
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::outPacker" uses
undefined class"CRPCOutParaPacker"
Why?
.

User: "Ian Collins"

Title: Re: Question about shared library (DLL) export & import 01 Feb 2007 08:23:55 PM
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.
.


  Page 1 of 1

1

 


Related Articles
 

NEWER

pg.1232     pg.940     pg.716     pg.544     pg.412     pg.311     pg.234     pg.175     pg.130     pg.96     pg.70     pg.50     pg.35     pg.24     pg.16     pg.10     pg.6     pg.3     pg.1

OLDER