Closed relativ closed 6 years ago
Do put delphi components in a dll, both the host and dlls need to use packages. You still need to register the plugin then.
I'm afraid I can't debug your code; I haven't used Delphi in 10 years or so.
Can someone help in there ? may you put some simple dll plugin example on repository ? I am sure some person have delphi installed on their machine :( 4 days I am still trying this please help
Please look into samples about 'runtime packages'. It's to much to explain in one or two lines, but basicly you need to change you're project settings and start using 'runtime packages'. When doing so, only add packages, which need to be 'dynamicly' linked.
There are three things you need for plugin capabilities (in genereal)
Hello,
I am trying to write pascalscript module in a dll to run by like loading extensions. the program seing defined objects in dll but cannot see the properties of object. I mean when I remove dll I am getting TSQLConnection not defined error when I plug dll program seeing TSQLConnection but cannot see properties of TSQLConnection object. Can you send me same sample about that how to load new objects as in external dll
I am getting [Error] (10:16): Unknown identifier 'PROVIDERNAME' error message but providername defined in bottom unit.
Please help thank you.
`unit uPSI_SQLConnection; { This file has been generated by UnitParser v0.7, written by M. Knight and updated by NP. v/d Spek and George Birbilis. Source Code from Carlo Kok has been used to implement various sections of UnitParser. Components of ROPS are used in the construction of UnitParser, code implementing the class wrapper is taken from Carlo Kok's conv utility
} interface
uses SysUtils ,Classes ,uPSComponent ,uPSRuntime ,uPSCompiler ;
type (----------------------------------------------------------------------------) PPSPascalCompiler = ^ TPSPascalCompiler; PPSRuntimeClassImporter = ^ TPSRuntimeClassImporter;
{ compile-time registration functions } procedure SIRegister_TSQLConnection(CL: TPSPascalCompiler); procedure SIRegister(CL: PPSPascalCompiler); stdcall;
{ run-time registration functions } procedure RIRegister_TSQLConnection(CL: TPSRuntimeClassImporter); procedure RIRegister(CL: PPSRuntimeClassImporter); stdcall;
implementation
uses DB ,DBAccess ,Uni ,MemDS ,MongoDBUniProvider ,SQLiteUniProvider ,SQLServerUniProvider ,PostgreSQLUniProvider ,OracleUniProvider ,NexusDBUniProvider ,MySQLUniProvider ,InterBaseUniProvider ,DBFUniProvider ,DB2UniProvider ,ASEUniProvider ,AdvantageUniProvider ,UniProvider ,ODBCUniProvider ,AccessUniProvider ,SQLConnection ;
( === compile-time registration functions === )
(----------------------------------------------------------------------------) procedure SIRegister_TSQLConnection(CL: TPSPascalCompiler); var psClass: TPSCompileTimeClass; begin //with RegClassS(CL,'TObject', 'TSQLConnection') do
psClass := CL.AddClassN(CL.FindClass('TObject'),'TSQLConnection'); psClass.RegisterMethod('Constructor Create'); psClass.RegisterMethod('Procedure Open( )'); psClass.RegisterMethod('Procedure Close( )'); psClass.RegisterProperty('ProviderName', 'AnsiString', iptrw); psClass.RegisterProperty('UserName', 'AnsiString', iptrw); psClass.RegisterProperty('Password', 'AnsiString', iptrw); psClass.RegisterProperty('Server', 'AnsiString', iptrw); psClass.RegisterProperty('Database', 'AnsiString', iptrw); psClass.RegisterProperty('Connected', 'boolean', iptrw); end;
(----------------------------------------------------------------------------) procedure SIRegister(CL: PPSPascalCompiler); begin SIRegister_TSQLConnection(CL^); end;
( === run-time registration functions === )
(----------------------------------------------------------------------------) procedure TSQLConnectionConnected_W(Self: TSQLConnection; const T: boolean); begin Self.Connected := T; end;
(----------------------------------------------------------------------------) procedure TSQLConnectionConnected_R(Self: TSQLConnection; var T: boolean); begin T := Self.Connected; end;
(----------------------------------------------------------------------------) procedure TSQLConnectionDatabase_W(Self: TSQLConnection; const T: AnsiString); begin Self.Database := T; end;
(----------------------------------------------------------------------------) procedure TSQLConnectionDatabase_R(Self: TSQLConnection; var T: AnsiString); begin T := Self.Database; end;
(----------------------------------------------------------------------------) procedure TSQLConnectionServer_W(Self: TSQLConnection; const T: AnsiString); begin Self.Server := T; end;
(----------------------------------------------------------------------------) procedure TSQLConnectionServer_R(Self: TSQLConnection; var T: AnsiString); begin T := Self.Server; end;
(----------------------------------------------------------------------------) procedure TSQLConnectionPassword_W(Self: TSQLConnection; const T: AnsiString); begin Self.Password := T; end;
(----------------------------------------------------------------------------) procedure TSQLConnectionPassword_R(Self: TSQLConnection; var T: AnsiString); begin T := Self.Password; end;
(----------------------------------------------------------------------------) procedure TSQLConnectionUserName_W(Self: TSQLConnection; const T: AnsiString); begin Self.UserName := T; end;
(----------------------------------------------------------------------------) procedure TSQLConnectionUserName_R(Self: TSQLConnection; var T: AnsiString); begin T := Self.UserName; end;
(----------------------------------------------------------------------------) procedure TSQLConnectionProviderName_W(Self: TSQLConnection; const T: AnsiString); begin Self.ProviderName := T; end;
(----------------------------------------------------------------------------) procedure TSQLConnectionProviderName_R(Self: TSQLConnection; var T: AnsiString); begin T := Self.ProviderName; end;
(----------------------------------------------------------------------------) procedure RIRegister_TSQLConnection(CL: TPSRuntimeClassImporter); var psClass : TPSRuntimeClass; begin psClass := CL.Add(TSQLConnection); psClass.RegisterConstructor(@TSQLConnection.Create, 'Create'); psClass.RegisterMethod(@TSQLConnection.Open, 'Open'); psClass.RegisterMethod(@TSQLConnection.Close, 'Close'); psClass.RegisterPropertyHelper(@TSQLConnectionProviderName_R,@TSQLConnectionProviderName_W,'ProviderName'); psClass.RegisterPropertyHelper(@TSQLConnectionUserName_R,@TSQLConnectionUserName_W,'UserName'); psClass.RegisterPropertyHelper(@TSQLConnectionPassword_R,@TSQLConnectionPassword_W,'Password'); psClass.RegisterPropertyHelper(@TSQLConnectionServer_R,@TSQLConnectionServer_W,'Server'); psClass.RegisterPropertyHelper(@TSQLConnectionDatabase_R,@TSQLConnectionDatabase_W,'Database'); psClass.RegisterPropertyHelper(@TSQLConnectionConnected_R,@TSQLConnectionConnected_W,'Connected'); end;
(----------------------------------------------------------------------------) procedure RIRegister(CL: PPSRuntimeClassImporter); begin RIRegister_TSQLConnection(CL^); end;
end.`