🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

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

#5876
From: Remy Lebeau (TeamB)
Date: Wed, 29 Jun 2005 05:34
31 lines
2236 bytes
"sky" <huangc@motic.com> wrote in message
news:42c21cc2@newsgroups.borland.com...

> 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

Where exactly is the Derived class being created?  Is it in the DLL, or in
the EXE?  Please show your actual compilable code that reproduces the
problem.

> 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?

I cannot answer that for sure until you show code that can reproduce the
problem.  You are probably calling the method via an invalid pointer to the
object.

> 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.

What is the exact error message?  Is it a compile error, or a runtime error?


Gambit
Technical Details
Message-ID: <42c23546$2@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news-out.nntp.be!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> <42c21cc2@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,6f086e2adea8beea
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <42c0c61f$1@newsgroups.borland.com> <42c0d8a3$1@newsgroups.borland.com> <42c21cc2@newsgroups.borland.com>
Subject: Re: How to export a C++ object from DLL
Date: Tue, 28 Jun 2005 22:34:39 -0700
Lines: 33
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.69.17.41
Message-ID: <42c23546$2@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1120023878 68.69.17.41 (28 Jun 2005 22:44:38 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail