delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/01/06/07:09:27

X-Spam-Check-By: sourceware.org
Date: Fri, 6 Jan 2006 13:09:14 +0100
From: "Gerrit P. Haase" <freeweb AT nyckelpiga DOT de>
Reply-To: "Gerrit P. Haase" <freeweb AT nyckelpiga DOT de>
Message-ID: <1061381307525.20060106130914@familiehaase.de>
To: Ilia Mirkin <imirkin AT MIT DOT EDU>
CC: cygwin AT cygwin DOT com
Subject: Re: std::string across DLL boundaries
In-Reply-To: <1136353916.11293.416.camel@localhost>
References: <1136353916 DOT 11293 DOT 416 DOT camel AT localhost>
MIME-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Ilia wrote:

> Hi,

> I've run into a problem passing a string ref to a dll:

> testdll.C: (I've tried adding __declspec(dllimport/export) too)

> void f(std::string& a) { a = "asdf"; }

> test.C:

> int main(void) { std::string a; f(a); std::cout << a << std::endl; }

> If I compile it with static linking, the program works as expected. If f
> is in a dll, then I can't get it to work -- different setups either go
> into an infinite loop at a = "asdf", or dump core.

> If, on the other hand, I do std::string a = "qwer", then it will work
> fine -- it seems as though there may be a problem with the allocator in
> libg++, though I may just be supplying the wrong flags to gcc.

> Could someone either confirm that this is a problem, or, preferably,
> provide instructions for getting this to compile "correctly"? (And if
> this is a problem, are there known workarounds, is there a PR open
> somewhere, etc)

Yes, there was already some related discussion and I opened a PR:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24196


> Thanks,

> Ilia

> P.S. This works fine with MinGW, so it's not some huge windows dll
> limitation.

Gerrit
-- 
=^..^=                                     http://nyckelpiga.de/donate.html



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019