🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

dll/memory manager question

#14038
From: Benny Hill
Date: Sat, 06 Sep 2003 14:25
24 lines
1477 bytes
I understand that it is a bad idea to create an object in a dll 
and then free the memory for that object in the calling program.

My question is:

if I create an "Example" object described like this:

class Example{
public:
   std::vector<std::string> Var;
};

in my executable and then call a function in a dll that looks like this:

void DLLMethod(Example& ex){
   std::string str = "some brand new string";
   ex.Var.push_back(str);
}

who allocated the memory for the new string object in my vector?  The
executable "owns" the vector but the allocation occured in the DLL.

Thanks,
Benny
Technical Details
Message-ID: <pan.2003.09.06.14.25.25.708900@yahoo.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,7f8fbb07565f6d83,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-09-06 07:31:10 PST
From: "Benny Hill" <benny_hill3@yahoo.com>
Subject: dll/memory manager question
Date: Sat, 06 Sep 2003 09:25:26 -0500
User-Agent: Pan/0.13.3 (That cat's something I can't explain)
Message-ID: <pan.2003.09.06.14.25.25.708900@yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
NNTP-Posting-Host: 12.218.138.79
X-Trace: newsgroups.borland.com 1062858325 12.218.138.79 (6 Sep 2003 07:25:25 -0700)
Lines: 24
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail