Z
zbsz515
Unregistered / Unconfirmed
GUEST, unregistred user!
vc 程序:
#include "stdafx.h"
#include "6dll.h"
extern "C"_declspec(dllexport) CString Getstr(void)
{
CString a;
a="556565656";
return(a);
}
delphi 声明
unit Unit2;
interface
function Getstr()char;stdcall;
implementation
function Getstr;external '6.dll' name 'Getstr';
end.
调用:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Button1: TButton;
Edit4: TEdit;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
memo1.Text:=getstr;
end;
end.
但回传的字符串并不正确,请教
#include "stdafx.h"
#include "6dll.h"
extern "C"_declspec(dllexport) CString Getstr(void)
{
CString a;
a="556565656";
return(a);
}
delphi 声明
unit Unit2;
interface
function Getstr()char;stdcall;
implementation
function Getstr;external '6.dll' name 'Getstr';
end.
调用:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Button1: TButton;
Edit4: TEdit;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
memo1.Text:=getstr;
end;
end.
但回传的字符串并不正确,请教