🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: cn.comp.lang.vc
Article #30

DLLģ������ģ��Ķ��ڴ�����

#30
From: zhiguo.zhao
Date: Sun, 20 Mar 2005 07:24
29 lines
1986 bytes
������һ������
class A;

class B{
public:
  typedef std::vector<c> cvector;
  cvector _cvector;
public:

B(){};
~B(){};
}
DLL�е�һ������ proc������
bool proc(B& b)
{
   A a;
   b._cvector.push_back(a);
}

��exe����LoadLibrary GetProcAddress��ȡproc
B b;
proc(b)
����b������ʱ�����ָ�����⣬_CrtIsValidHeapPointer�����׳��쳣
If a dynamic-linked library (DLL) contains a static link to the run-time
library, then it has its own instance of the run-time heap, and therefore
its own heap, independent of the application's local heap.
����Ļ�DLL����һ�������Ķѣ���Ӧ�ó���ĶѶ�����������proc������Ĵ����ı�push_back��vector��A���󸱱���DLL���У���B��������ʱ�򣬻��ͷ�DLL���е��ڴ棬���Ե��´��󣿣���

��λ��Ϻ�м�ʵ�õĽ���취�����֪��
Technical Details
Message-ID: <d1j8sb$jcp$1@mail.cn99.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsfeed.media.kyoto-u.ac.jp!news.cn99.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: fe22c,70f62700b76de1df,start
X-Google-Attributes: gidfe22c,public
X-Google-Language: ENGLISH,ASCII
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsfeed.media.kyoto-u.ac.jp!news.cn99.com!not-for-mail
From: "zhiguo.zhao" <shybt@hotmail.com>
Newsgroups: cn.comp.lang.vc
Subject: DLLģ������ģ��Ķ��ڴ�����
Date: Sun, 20 Mar 2005 15:24:15 +0800
Organization: Bentium Ltd. (CN99)
Lines: 32
Message-ID: <d1j8sb$jcp$1@mail.cn99.com>
NNTP-Posting-Host: 61.51.109.202
X-Trace: mail.cn99.com 1111303883 19865 61.51.109.202 (20 Mar 2005 07:31:23 GMT)
X-Complaints-To: usenet@news.cn99.com
NNTP-Posting-Date: Sun, 20 Mar 2005 07:31:23 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2179
X-Mimeole: Produced By Microsoft MimeOLE V6.00.2900.2179
X-RFC2646: Format=Flowed; Original