Article View: borland.public.cppbuilder.nativeapi
Article #10496Re: DLL and std::string?
From: Hans-Jochen Trost
Date: Tue, 13 Apr 2004 00:13
Date: Tue, 13 Apr 2004 00:13
35 lines
2386 bytes
2386 bytes
Nick, Remy,
if you use ifstream or similar streams in a statically compiled DLL,
and perhaps in your main executable as well, you may be subject to
collisions of memory management code between the DLL and the main
executable. I have banned stream I/O from my DLLs for that very
reason. It is possible that you have to load the DLL at runtime to
make the problem happen (which I do) but I cannot promise that you
have to.
Cheers, Jochen
On Wed, 7 Apr 2004 19:17:05 +0200, "nicolasr"
<nicolasrNOSPAMATSIGNgmx.net> wrote:
>thanks for the code. I switched everything to using char*
>and added the missing __stdcall declaraction.
>The ifstream stack corruption remains, though. I also
>searched Google and it seems other people had similar problems.
>
>I replaced std::ifstream with TFileStream and now it works!
>
>Nick
>
>> It is not related to the std::ifstream itself, but more likely to the
>> std::string that you passed to it. Once you change to char* instead, you
>> shouldn't have the problem anymore. For example:
[snip]
hjtrost at microfab dot com
Nil nimium studeo, Caesar, tibi velle placere,
nec scire ut an sis albus an ater homo.
Catullus
Technical Details
Message-ID:
<4ubm70d2vihvampfaphc1u0795ffm36t3d@4ax.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!in.100proofnews.com!in.100proofnews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<40733f34@newsgroups.borland.com> <40734b69$1@newsgroups.borland.com> <407356a8$1@newsgroups.borland.com> <407357f0@newsgroups.borland.com> <40743797@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,fd71d18cb19fccaf X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2004-04-12 17:26:28 PST From: Hans-Jochen Trost <dont-email@but.post-re.ply> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: DLL and std::string? Date: Mon, 12 Apr 2004 19:13:10 -0500 Organization: MicroFab Technologies, Inc. Reply-To: dont-email@but.post-re.ply Message-ID: <4ubm70d2vihvampfaphc1u0795ffm36t3d@4ax.com> References: <40733f34@newsgroups.borland.com> <40734b69$1@newsgroups.borland.com> <407356a8$1@newsgroups.borland.com> <407357f0@newsgroups.borland.com> <40743797@newsgroups.borland.com> X-Newsreader: Forte Free Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 66.14.146.145 X-Trace: newsgroups.borland.com 1081815187 66.14.146.145 (12 Apr 2004 17:13:07 -0800) Lines: 35 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!in.100proofnews.com!in.100proofnews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail