🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #5875

Re: How to export a C++ object from DLL

#5875
From: sky
Date: Wed, 29 Jun 2005 03:59
51 lines
2589 bytes
Thank you Remy

Where the shoe pinches is that the object in the DLL can't be operated 
normally

for example, a abstract class(Base) declared in the DLL and class Derive 
inherited from it, the Derive class is instantiated when the DLL has been 
Loaded and the EXE write can get a Base class pointer point to the Derive 
object via the export function of the DLL, but I can't access the data 
member and some virtual function

i.e.
1. can't access data member
a int variant has been initialized with 0 in the constructor of the Derive, 
but when I access it in a member function, I found the value has changed, so 
I print the address of that variant, it's actually difference in the 
constructor and member function, why?

2. virtual function that add to the Derive can't be invoked
the program show a error message when the virtual function is been invoking.

Any hint?

sorry for my poor English, if you don't understand the question, I'll try to 
descript it again.

sky



"Remy Lebeau (TeamB)" <no.spam@no.spam.com> д����Ϣ����:42c0d8a3$1@newsgroups.borland.com...
>
> "sky" <huangc@motic.com> wrote in message
> news:42c0c61f$1@newsgroups.borland.com...
>
>> 1. vritual function can't be invoked in the inherit class
>>
>> 2. data member can't be accessed
>
> Please elaborate.
>
>> there is a error when i invoke the Refresh()
>> via g_pB Pointer out of the DLL
>
> What is the exact error?  Is it a compiler error?  A linker error?  A
> runtime error?
>
>
> Gambit
>
> 
Technical Details
Message-ID: <42c21cc2@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!mpls-transit-01.news.qwest.net!38.119.100.82.MISMATCH!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <42c0c61f$1@newsgroups.borland.com> <42c0d8a3$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,6f086e2adea8beea
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII
Reply-To: "sky" <huangc@motic.com>
From: "sky" <huangc@motic.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <42c0c61f$1@newsgroups.borland.com> <42c0d8a3$1@newsgroups.borland.com>
Subject: Re: How to export a C++ object from DLL
Date: Wed, 29 Jun 2005 11:59:57 +0800
Lines: 53
Organization: ckhome
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 218.85.121.51
Message-ID: <42c21cc2@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1120017602 218.85.121.51 (28 Jun 2005 21:00:02 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!mpls-transit-01.news.qwest.net!38.119.100.82.MISMATCH!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail