S
SmallGhost
Unregistered / Unconfirmed
GUEST, unregistred user!
我再程序启动的时候动态加载了一个DLL,在Uses中包含了Sharemem单元,可是在执行程序
中LoadLibrary后马上调用FreeLibrary函数就会提示一个下列错误:
project HY.exe raised too many consecutive exceptions: 'access violation at 0x00000000;read of address 0x00000000'.process stopped.use step or run to continue.
装载部分的代码如下:
m_hHandle := LoadLibrary(PChar(arg_szFile));
if m_hHandle <> 0 then
begin
FreeLibrary(m_hHandle)
// 就在这里提示上述错误
end;
在DLL中没有作任何代码,在工程创建后就在uses中加入了Sharemem单元,代码如下:
library Project1;
{ 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. }
uses
Sharemem, // 就是这里错,如果我把它去掉,就不会提示错误
SysUtils,
Classes;
{$R *.res}
begin
end.
真是不知道为什么呀!
中LoadLibrary后马上调用FreeLibrary函数就会提示一个下列错误:
project HY.exe raised too many consecutive exceptions: 'access violation at 0x00000000;read of address 0x00000000'.process stopped.use step or run to continue.
装载部分的代码如下:
m_hHandle := LoadLibrary(PChar(arg_szFile));
if m_hHandle <> 0 then
begin
FreeLibrary(m_hHandle)
// 就在这里提示上述错误
end;
在DLL中没有作任何代码,在工程创建后就在uses中加入了Sharemem单元,代码如下:
library Project1;
{ 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. }
uses
Sharemem, // 就是这里错,如果我把它去掉,就不会提示错误
SysUtils,
Classes;
{$R *.res}
begin
end.
真是不知道为什么呀!