在DLL文件中写到:
function wooddostotxt(dir:pchar):integer;stdcall;
begin
....
end;
在主程序中写到:
var
Form1: TForm1;
dir:array [0..512] of char;implementationfunction wooddostotxt(dir:pchar):integer;stdcall;external 'project1.dll';{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
begin
dir:='c:\tax';
wooddostotxt(dir);
end;这样写出来的程序一直报错,而按F7分步执行到最后也不报错,但是普通执行,程序会出错,出错信息是:access violation at address 00000000,read of address 00000000,请问这是什么原因啊
function wooddostotxt(dir:pchar):integer;stdcall;
begin
....
end;
在主程序中写到:
var
Form1: TForm1;
dir:array [0..512] of char;implementationfunction wooddostotxt(dir:pchar):integer;stdcall;external 'project1.dll';{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
begin
dir:='c:\tax';
wooddostotxt(dir);
end;这样写出来的程序一直报错,而按F7分步执行到最后也不报错,但是普通执行,程序会出错,出错信息是:access violation at address 00000000,read of address 00000000,请问这是什么原因啊
解决方案 »
- Delphi 中 QRDBText 中怎么让它自动换行?
- 日期框问题
- fastreport 4.0 预览问题?
- 在一个子窗体中如何判断另一个子窗体当前是否存在?
- 初学者问题,为什么用DCOMConnection,选择了GUID后,“服务器运行失败!”
- 请问在DELPHI 7.0中的FTP控件有吗,如果没有,用什么控件可以做FTP客户程序,谢谢!
- 请教一下DecodeTime()函数和EncodeTime()的使用方法?
- 请问:VC++,C#,Delphi,VB,Java这几种语言之间该怎样选择?
- 各位程序高手,我有一个小问题,请帮帮我。26分我只能给这么多了。
- 请问在哪里能找到Delphi的编码规范, 中英文都行, 最好能有具体网址
- 向数据库中写数据!!急!
- 如何使得RichEdit得到焦点时,光标移到所有已输入内容的最后面?
{ 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. }
pchar是delphi标准...如果不行再换成string试试...string应该是肯定可以的.
Application.Process
然后再试
var
pstr: Pchar;
begin
pstr:='c:\tax';
wooddostotxt(pstr);
end;
var
pstr: Pchar;
begin
pstr:=Pchar('c:\tax');
wooddostotxt(pstr);
end;
1.function wooddostotxt(dir:pchar):integer;stdcall;external 'project1.dll';
====>
function wooddostotxt(dir:pchar):integer;cdecl;external 'project1.dll';2.Dll中的wooddostotxt方法后面用stdCall调用习惯;
开发环境:DELPHI 2005+SP2
软件运行环境:XP SP2