artem_niko Posted February 20, 2022 Author Share Posted February 20, 2022 On 8/27/2021 at 9:39 AM, herculanojs said: MainProject.zip 39.42 kB · 5 downloads Greetings! Forgive me for asking questions, but please help me with one more thing. Look. 1. I start MainProject: The application starts. Everything seems to be fine, judging by the files: 2. I click the Connect BPL button and connect the frame: The connected BPL is displayed in a frame. Everything is fine, as it should be, everything works, the project works. Then I needed to make changes to the BPL and reconnect it. Let's say I did that, made changes to the BPL. For example, I change the color of the panel and try to compile the BPL: Like BPL compiles: At the same time, some strange file with a tilde is created in the directory of the main project where BPL is compiled (I understand that this is some temporary one, apparently): Now I, in the main project, press the button and Free Frame + unloadpackage and unload the BPL: Now, I want to connect the updated BPL package again, but the updated BPL is not connected, but the previous one is connected: Ultimately, the updated BPL is connected only if the project server is stopped, closed, and restarted. Only after this action is the updated BPL connected: Help me finish it so that you don't have to stop the main project, but you can reconnect the BPL without stopping the main project. Is it realistic to do it? MainProject_new.zip Quote Link to comment Share on other sites More sharing options...
Abaksoft Posted February 20, 2022 Share Posted February 20, 2022 6 hours ago, artem_niko said: Greetings! MainProject_new.zip 2.44 MB · 1 download Hello, I saw your interest in using BPL. This is an old technique from the time of Delphi 5, to get a small .exe file and for better memory management. Today, with the performance of the hardware used, we no longer need to worry about all that. Apart from occasional, well-targeted updates. Coud you please, tel us Why do you still want to use BPL packages? Quote Link to comment Share on other sites More sharing options...
Abaksoft Posted March 11, 2022 Share Posted March 11, 2022 I have an application (standard vcl) which exceeds 40MB in exe and after reading your topic, I was tempted to compile it with its packages. Results Here is the summary of my research. I found that there are more cons than pros: 1. Benefits : - you barely gain some 10 MB for the exe - The updates would be punctual: would only point to part of the changed code. - Economy and better RAM management if several applications (with bpl and developed with the same Delphi version) are installed on the same client PC 2. Disadvantages: - The Setup CD would be huge (since it would contain all the Bpl packages) - If you change Delphi version, you must redistribute the new BPL packages - the program becomes less stable - Problem with Tracking memory leak - what about Reverse ingeneering problem ? you should find more robust protection. Regards https://stackoverflow.com/questions/1898560/why-does-building-with-runtime-packages-make-the-exe-file-smaller Quote Link to comment Share on other sites More sharing options...
风吹小机机 Posted March 23, 2022 Share Posted March 23, 2022 I use DLL mode Quote Link to comment Share on other sites More sharing options...
Abaksoft Posted March 23, 2022 Share Posted March 23, 2022 3 hours ago, 风吹小机机 said: I use DLL mode Thx. Could you please explain in more details. I am curious to see that. Quote Link to comment Share on other sites More sharing options...
风吹小机机 Posted March 23, 2022 Share Posted March 23, 2022 3 hours ago, Abaksoft said: Thx. Could you please explain in more details. I am curious to see that. That is, the module code is written in the DLL, and the basic code is written in the framework body [such as connecting data, calling permission, etc.] DLL and framework body interact with each other through Delphi internal interface Of course, my framework can be separated from Delphi development [i.e. online runtime development], but some special functions still need to be encapsulated by modular DLL. My DLL can support unifrom and uniframe, and can also register the functions and processes inside the framework Quote Link to comment Share on other sites More sharing options...
Abaksoft Posted March 23, 2022 Share Posted March 23, 2022 5 hours ago, 风吹小机机 said: My DLL can support unifrom and uniframe, and can also register the functions and processes inside the framework Great Something like this ? procedure DoingSomething; stdcall; external 'toto.dll'; With DoingSomething on Unigui Side and toto.dll a classical Delphi DLL ? Quote Link to comment Share on other sites More sharing options...
风吹小机机 Posted March 24, 2022 Share Posted March 24, 2022 Yes, the classic Delphi DLL One main program and multiple business module DLLs or function DLLs 1 Quote Link to comment Share on other sites More sharing options...
Abaksoft Posted March 24, 2022 Share Posted March 24, 2022 2 hours ago, 风吹小机机 said: Yes, the classic Delphi DLL One main program and multiple business module DLLs or function DLLs Thx. Quote Link to comment Share on other sites More sharing options...
dekmai Posted April 21, 2022 Share Posted April 21, 2022 can download example project ? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 21, 2022 Share Posted April 21, 2022 24 minutes ago, dekmai said: can download example project ? Hello, 1 Quote Link to comment Share on other sites More sharing options...
artem_niko Posted November 22, 2022 Author Share Posted November 22, 2022 On 8/22/2021 at 10:48 PM, herculanojs said: Hello! Is it possible transfer HModule from MainForm, using code? As, by analogy for string values: var MyHModuleVar: HMODULE; begin ... if IsPublishedProp(UniFrame1,'GV_Test') then SetPropValue(UniFrame1,'GV_Test',MyHModuleVar); ... In UniFrame1: ... private procedure SetGlobalValue(const MyHModuleVar: HMODULE); ... and: ... published property GV_Test: hmodule read GetttingValue write SetGlobalValue; It seems to work, my HModule variable is passed, but when I use the UnloadPackage(MyHModuleVar) function in UniFrame1, I get an AV error... Quote Link to comment Share on other sites More sharing options...
artem_niko Posted November 26, 2022 Author Share Posted November 26, 2022 Hello, again!) Well, I'll try to explain what I've done so far. So, in the main application, I prescribed: ... private procedure SetGlobalValue_UnloadingBPL(const Value: HModule); public test1, test2: HModule; //test1 - что передаю, test2 - для обратного получения в главное приложение property GV_UnloadingBPL: HModule read UnloadingBPL write SetGlobalValue_UnloadingBPL; ... The code of the button for passing the variable to the frame: ... if IsPublishedProp(Frame1,'GV_UnloadingBPL') then SetPropValue(Frame1,'GV_UnloadingBPL',test1); ... Now I get my variable in the frame itself: ... private procedure SetGlobalValue_GettingBPL(const Value: HModule); public FG_GettingValue: HModule; //куда запоминаю переменную property GV_UnloadingBPL: HModule read FG_GettingValue write SetGlobalValue_GettingBPL; ... Code for getting a variable in a frame: procedure TUniFrameG1.SetGlobalValue_GettingBPL(const Value: NativeUInt); begin FG_GettingValue:=Value; end; And here is the code when the frame closes (it closes by timer): procedure TUniFrameG1.UniTimer_CloseTimer(Sender: TObject); begin if IsPublishedProp(Self,'test2') then SetPropValue(Self,'test2',FG_GettingValue); end; Then, I try to unload the BPL in the main program when closing TabSheet1: procedure TMainForm.UniTabSheet1_Close(Sender: TObject; var AllowClose: Boolean); begin SetGlobalValue_UnloadingBPL(test2); if test2<> 0 then begin ShowMessage('Пакет загружен'); UnloadPackage(test2); end; end; And so, when doing all this, I get an error in the main program: Invalid package handle Please, help me... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.