我在dll中为Treeview添加Node,但是在dll中添加的Node一clear就出错,大家帮帮忙看一下,很急!(100分)

D

dirk

Unregistered / Unconfirmed
GUEST, unregistred user!
还有,only you,照这里的说法,record、class中使用了string类型,都必须用到
sharemem单元才行,但是,大多数(也许是所有的)VCL中大概都用到string类型的变量,
那么就是说,凡是在dll中要用VCL组件(用到string变量的那些),就必须用sharemem,
那么,在程序发布时,就同时要把BORLNDMM.DLL也带上,发布吗?
这个好像比较麻烦,能向下面说的,用pchar代替string,但是用到string的record和
class怎么办?
{ Important note about DLL memory management: ShareMem must be the
first unit in your library's USES clause AND your project's (select
Project-View Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the BORLNDMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using BORLNDMM.DLL, pass string information
using PChar or ShortString parameters. }
 
O

only you

Unregistered / Unconfirmed
GUEST, unregistred user!
没办法!这是Borland定下的规矩!主要是因为Delphi对String采用了动态管理内存的机制,
你必须明确的告诉系统由谁来回收它!所以,很可惜,这一切是必然的!解决的办法当然是你
尽可能的不要在DLL和应用程序之间传递那些包含string的控件和类,这样就避免在分发的
时候还要带上一个BORLNDMM.DLL
 
D

dirk

Unregistered / Unconfirmed
GUEST, unregistred user!
only you、testnet,感谢你们给我的帮助,我说过解决后加分的,请到我的新贴子里来
拿分吧!

http://www.delphibbs.com/delphibbs/dispq.asp?lid=1228483
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
753
import
I
顶部