Open relativ opened 3 years ago
? failed event wrapper for OnStatus ? read this: https://github.com/remobjects/pascalscript/issues/230
yes and ichecked out code everything normal as #230
i don't understand solving with reading #230 can you explain ?
There is not enough information in your question to answer. No wrapper code showed for "TFTP.OnStatus".
wrapper code; i cut just some where for you . actually i implement with imp.exe in pascalscipt.
thanks
procedure RIRegister_Socket(CL: TPSRuntimeClassImporter);
begin
RIRegister_TSocketIOHandler(CL);
RIRegister_TTCPClient(CL);
RIRegister_TUDPClient(CL);
RIRegister_THttpClient(CL);
RIRegister_TEmail(CL);
RIRegister_TFTP(CL);
end;
procedure SIRegister_Socket(CL: TPSPascalCompiler);
begin
SIRegister_TSocketIOHandler(CL);
SIRegister_TTCPClient(CL);
SIRegister_TUDPClient(CL);
SIRegister_THttpClient(CL);
SIRegister_TEmail(CL);
CL.AddTypeS('TOnStatusEvent', 'Procedure ( ASender : TObject; AStatusText : string)');
SIRegister_TFTP(CL);
end;
This is not enough. It is unclear whether all the necessary wrappers have been created. Wrappers are conveniently done using the "unit-importing/imp.dpr" tool. Need to see type declarations, method signatures, and some implementations:
need to see:
procedure SIRegister_TFTP(CL: TPSPascalCompiler);
for property TFTP.OnStatus
with CL.AddClassN(CL.FindClass('TFTP'),'TComponent') do
RegisterProperty('OnStatus', 'TOnStatusEvent', iptrw);
need to see:
procedure RIRegister_TFTP(CL: TPSRuntimeClassImporter);
with CL.Add(TFTP) do
RegisterPropertyHelper(@TFTP_OnStatus_R,@TFTP_OnStatus_W,'OnStatus');
need to see:
procedure TFTP_OnStatus_W(Self: TFTP; const T: TOnStatusEvent);
begin Self.OnStatus := T; end;
procedure TFTP_OnStatus_R(Self: TFTP; var T: TOnStatusEvent); begin T := Self.OnStatus; end;
procedure RIRegister_TFTP(CL: TPSRuntimeClassImporter);
begin
with CL.Add(TFTP) do
begin
RegisterConstructor(@TFTP.Create, 'Create');
RegisterMethod(@TFTP.Abort, 'Abort');
RegisterMethod(@TFTP.ChangeDir, 'ChangeDir');
RegisterMethod(@TFTP.ChangeDirUp, 'ChangeDirUp');
RegisterMethod(@TFTP.Connect, 'Connect');
RegisterMethod(@TFTP.Delete, 'Delete');
RegisterMethod(@TFTP.Get, 'Get');
RegisterMethod(@TFTP.List, 'List');
RegisterMethod(@TFTP.Login, 'Login');
RegisterMethod(@TFTP.MakeDir, 'MakeDir');
RegisterMethod(@TFTP.Put, 'Put');
RegisterMethod(@TFTP.PutStream, 'PutStream');
RegisterMethod(@TFTP.RemoveDir, 'RemoveDir');
RegisterMethod(@TFTP.Rename, 'Rename');
RegisterMethod(@TFTP.Status, 'Status');
RegisterMethod(@TFTP.Connected, 'Connected');
RegisterMethod(@TFTP.Disconnect, 'Disconnect');
RegisterMethod(@TFTP.Size, 'Size');
RegisterPropertyHelper(@TFTPHost_R,@TFTPHost_W,'Host');
RegisterPropertyHelper(@TFTPPassive_R,@TFTPPassive_W,'Passive');
RegisterPropertyHelper(@TFTPPassword_R,@TFTPPassword_W,'Password');
RegisterPropertyHelper(@TFTPUsername_R,@TFTPUsername_W,'Username');
RegisterPropertyHelper(@TFTPPort_R,@TFTPPort_W,'Port');
RegisterPropertyHelper(@TFTPListResult_R,nil,'ListResult');
RegisterPropertyHelper(@TFTPOnStatus_R,@TFTPOnStatus_W,'OnStatus');
end;
end;
(* === run-time registration functions === *)
(*----------------------------------------------------------------------------*)
procedure TFTPOnStatus_W(Self: TFTP; const T: TOnStatusEvent);
begin Self.OnStatus := T; end;
(*----------------------------------------------------------------------------*)
procedure TFTPOnStatus_R(Self: TFTP; var T: TOnStatusEvent);
begin T := Self.OnStatus; end;
(*----------------------------------------------------------------------------*)
procedure TFTPListResult_R(Self: TFTP; var T: TStrings);
begin T := Self.ListResult; end;
(*----------------------------------------------------------------------------*)
procedure TFTPPort_W(Self: TFTP; const T: integer);
begin Self.Port := T; end;
(*----------------------------------------------------------------------------*)
procedure TFTPPort_R(Self: TFTP; var T: integer);
begin T := Self.Port; end;
(*----------------------------------------------------------------------------*)
procedure TFTPUsername_W(Self: TFTP; const T: string);
begin Self.Username := T; end;
(*----------------------------------------------------------------------------*)
procedure TFTPUsername_R(Self: TFTP; var T: string);
begin T := Self.Username; end;
(*----------------------------------------------------------------------------*)
procedure TFTPPassword_W(Self: TFTP; const T: string);
begin Self.Password := T; end;
(*----------------------------------------------------------------------------*)
procedure TFTPPassword_R(Self: TFTP; var T: string);
begin T := Self.Password; end;
(*----------------------------------------------------------------------------*)
procedure TFTPPassive_W(Self: TFTP; const T: boolean);
begin Self.Passive := T; end;
(*----------------------------------------------------------------------------*)
procedure TFTPPassive_R(Self: TFTP; var T: boolean);
begin T := Self.Passive; end;
(*----------------------------------------------------------------------------*)
procedure TFTPHost_W(Self: TFTP; const T: string);
begin Self.Host := T; end;
(*----------------------------------------------------------------------------*)
procedure TFTPHost_R(Self: TFTP; var T: string);
begin T := Self.Host; end;
procedure SIRegister_TFTP(CL: TPSPascalCompiler);
begin
//with RegClassS(CL,'TObject', 'TFTP') do
with CL.AddClassN(CL.FindClass('TObject'),'TFTP') do
begin
RegisterMethod('Constructor Create');
RegisterMethod('Procedure Abort');
RegisterMethod('Procedure ChangeDir( ADirname : string)');
RegisterMethod('Procedure ChangeDirUp');
RegisterMethod('Procedure Connect');
RegisterMethod('Procedure Delete( AFilename : string)');
RegisterMethod('Procedure Get( Afilename : string; ADest : TStream)');
RegisterMethod('Procedure List');
RegisterMethod('Procedure Login');
RegisterMethod('Procedure MakeDir( ADirname : string)');
RegisterMethod('Procedure Put( AsourceFile : string; ADestFile : string)');
RegisterMethod('Procedure PutStream( ASource : TStream; ADeestFile : string)');
RegisterMethod('Procedure RemoveDir( ADirname : string)');
RegisterMethod('Procedure Rename( AsourceFile : string; AdestFile : string)');
RegisterMethod('Procedure Status( AStatus : TStrings)');
RegisterMethod('Function Connected : boolean');
RegisterMethod('Procedure Disconnect');
RegisterMethod('Function Size( AFilename : string) : integer');
RegisterProperty('Host', 'string', iptrw);
RegisterProperty('Passive', 'boolean', iptrw);
RegisterProperty('Password', 'string', iptrw);
RegisterProperty('Username', 'string', iptrw);
RegisterProperty('Port', 'integer', iptrw);
RegisterProperty('ListResult', 'TStrings', iptr);
RegisterProperty('OnStatus', 'TOnStatusEvent', iptrw);
end;
end;
Signature not shown for TOnStatusEvent.
There is a signature mismatch in your examples (see const AStatusText):
declaration:
CL.AddTypeS('TOnStatusEvent', 'Procedure ( ASender : TObject; AStatusText : string)');
script:
procedure OnStatus (ASender: TObject; const AStatusText: string);
begin
//Memo1.Lines.Add(AStatusText);
end;
Rarely: Also there may be a mismatch between the "string" type of the compiler and the rps-engine.
Still did not work and what is rps ?
rps - remobject pascal script
@carlokok help Carlo we haven't solve problem .
Try to make an example so that we can see all your code.
example : extension link
Your code fragments:
ClientSockets.dpr
library ClientSockets;
exports PSPluginCreate;
uPSI_Socket.pas
function PSPluginCreate(): TPSPlugin; stdcall;
var
Import: TPSImport_Socket;
begin
Import:= TPSImport_Socket.Create(nil);
Result := Import;
end;
TPSImport_Socket = class(TPSPlugin)
A class cannot be passed to a DLL as a parameter and an ordinary string (instead of string, you need WideString or Variant). In Package (BPL instead DLL) you can, but EXE and BPL must be compiled in the same Delphi version.
No not i guess old version of delphi cannot passed a class to a dll but this is working good.
In some particular case, this may work, but in the general case it is not true: it will fail/AV or there will be memory leaks ...
is there any progress about problem ?
rps not have problebs. problem is in your code...
hello,
i am getting acces violation error on script execute time . compiling is normal but when i calling execute method , it make access violation error.