#1 2020-05-26 07:01:21

konsul41
Member
Registered: 2020-05-21
Posts: 24

mormot i BPL

Client Program
fClient :=  TSQLHttpClient.Create('localhost','888',fModel);

How to forward "fClient" to BPL?


BPL ładowany poprzez LoadPackage(PChar(FileName));


Or Which plug-in model to choose to leave the small main application (menu + loading plugins) and transfer the rest to BPL or dll plugins

Offline

#2 2020-05-27 11:25:21

radexpol
Member
From: Poland, Krk
Registered: 2019-11-29
Posts: 116

Re: mormot i BPL

Konsul41, your question does not concern exact mORMot but general working with libraries. This is too complicated to give a precise answer, we need to understand entire application structure and your expectations. Usually you can pass any data through exported stcall methods (dll)

ps. (polish)
Kolego, pisz po angielsku: "BPL ładowany poprzez".

Offline

#3 2020-05-27 12:16:55

konsul41
Member
Registered: 2020-05-21
Posts: 24

Re: mormot i BPL

OKAY.
Google translator.

My program is a bit of a mix of technologies

// A factory that supports all plugins
IObjectFactory = interface
     ['{05C782E6-7DE7-46B4-82E0-22A5A64BEDB2}']
     procedure RegisterFactoryDriver(driver: IObjectFactoryDriver);
     procedure UnRegisterFactoryDriver(driver: IObjectFactoryDriver);
     function MakeNew(id: WideString): IUnknown;
     procedure Clear;
     function GetClient(): TSQLRestClientURI;
     procedure SetClient(const Value: TSQLRestClientURI);
     function UdostepnijKlienta(): TSQLRestClientURI;
   end;


procedure TObiekt.Exec(Sender: TObject);
var
    client    : TSQLRestClientURI;
    aResponse,
    RawBate   : RawUTF8;
    Lekarz    : TLekarz;
begin
  client:=fabryka.GetClient; //fabryka : IObjectFactory;
  client.CallBackGet('Eat',[],aResponse);
  Client.CallBackGet('GetFile',['filename','20200514_204819.jpg'],RawUTF8(RawBate));

  Lekarz:=TLekarz.Create;
  try
    Client.Model.AddTable(TLekarz);
    Client.Retrieve(1,Lekarz);
    ShowMessage('Imię i nazwisko Lekarza '+Lekarz.imie+' '+Lekarz.nazwisko);
  finally
    Lekarz.Free;
  end;
  Client.CallBackGet('Eat',[],aResponse);
end;

This function is connected with BPL to the main program menu and it works

the question concerns the mormot and the method of transmission
client: TSQLRestClientURI;
to bpl
is such a way safe or should it be done differently?
The question is because passing the client to BPL I lose tables from the model and I have to add
Client.Model.AddTable (TLekarz);

Last edited by konsul41 (2020-05-27 12:18:57)

Offline

#4 2020-05-27 18:45:45

konsul41
Member
Registered: 2020-05-21
Posts: 24

Re: mormot i BPL

I thought it was the operation of the menu.
No, that's not it.
I cleared all bpl of everything
i only do
LoadPackage
and
ModuleName: = ExtractFileName (getModuleName (BPLeMAIN [Length (BPLeMAIN)-1]));
UnloadPackage (BPLeMAIN [Length (BPLeMAIN)-1]);
modulename contains a valid file name

and I can only release the first BPL, and 2 and 3 not. I suppose all the following ones (which will be at all) cause the error "Invalid Package handle"
Can anyone verify this?

Last edited by konsul41 (2020-05-27 19:11:13)

Offline

Board footer

Powered by FluxBB