Jump to content

TurboMagic

Members
  • Content Count

    235
  • Joined

  • Last visited

  • Days Won

    9

Posts posted by TurboMagic


  1. Sorry, but it's now still unclear how to handle iOS in this regards (I don't have the toolchain for this one yet):

     

    1. Can Delphi create a dylib for iOS somebody else wih some other language could consume?
       (the StackOverflow post doesn't talk about dylibs)
       I know that it can for Android if creating a normal FMX app and stripping the FMX part out of that. But for iOS?
     

    2. What would speak against .a files? What's the downside of those getting linked into the application of the person
        consuming those?

     

    I simply need to create something somebodfy else in some different language has to use and that needs to work
    on Android and on iOS. And before investing time into some implementation which will not work on iOS at the end
    I wanted to get clarification about that one.


  2. Another question turned up now: from the shared objects (.so) I can create for Android I know, that I need to create one for 32 bit and one for 64 bit
    and need to place them into the right folders on the target device via deployment manager. Both have the same name though.

     

    Now what about .a files?
    When I generate them for 32 and 64 bit they will get output in the ios32 and ios64 or Android32 and Android64 subolders I guess.
    But the user of them using a different programming environment,, how has he to handle them? Place them into bitnnes/cpu dependant folders
    and have something conditional in his application so the right variant will be linked in?


  3. Thanks for the answer! Does this mean this is "self contained"? That's how I understood this. For as non package developer
    it always sounded like packages require that you provide the used RTL packages as well, but I guess this is not the case here?


  4. Thanks for the reply. As I haven't done any iOS development yet I don't have a MAC yet and thus wanted
    to investigate first whether it is possible for iOS at all.

     

    For Android it is possible but as written not via a library/DLL project! That won't properly work!
    As described one needs to generate a FMX project for this, as each of those generates an SO
    and then you strip out the FMX part and only grab the generated SO, which in a normal FMX project
    would be packed into the APK/AAB.


  5. I have some code written in Delphi which should be reused in mobile projects which are unfortunately not written in Delphi.

    I have found out that for Android you can create a shared object .so. Strangely not via using the DLL project type but by using
    the normal cross platform GUI type and then stripping off the GUI support.

     

    Now the question is, can I achieve something similar for iOS?
    Can I create a dynamic or static library some other iOS programming environment can consume?

     

    I just found this help topic:
    https://docwiki.embarcadero.com/RADStudio/Sydney/en/API_(*.bpl,_*.dylib,_*.so)

    Would that be a way? (I haven't developed any packages yet and I would only want to export procedural stuff)


  6. Hello,

     

    this question is quite low level. For the purpose of being used from some completely different programming language on Android I'm trying
    to check if I can rework a Windows DLL of mine into a shared object.

     

    I can create a shared object (.so) already, for this one has to be aware that the library project type in Delphi which would create a DLL on
    Windows won't create a .SO on Android. I consider this a bug or at least a missing feature. But you can create a .SO by creating an FMX
    project and throw out the use of the default generated form (and everything in the begin / end block of the DPR).

    The resulting SO can be used if the functions/procedures are called dynamically.

     

    Next step would be to get a timer up and running.

    I tried the FMX time, but that didn't work, it crashes as soon as I want to create it (segfault 11).

    So I looked into how this one is implemented and copied that code into my application (to have as few connections with RTL and
    FMX as possible). But it crashes on creation as well.

     

    I looked what is done under the hood and it is this:
    The timer needs a JHandler and this shall be fetched via Androidapi.Helpers.TAndroidHelper, which has a MainHandler class property.
    This accesses a FMainHandler field and if that is nil, it is initialized, but that needs a TJLooper.

    As far as I understood (see https://developer.android.com/reference/android/os/Handler) this is the equivalent of the Windows message loop.

     

    Can I replicate that somehow in my SO? What would I have to do to get this working?
    My test project is attached. If you want to try it, compile the libSOTest.so first, then run libSOTestGUI.

     

    Best regards

     

    TurboMagic

    SOTest.zip


  7. I still have my backup problem. Back then I started to implement a small test application. Today I added database opening, closing and reading out
    of some data capabilities for further testing/investigation. That test works as follows and doesn't show the error:

     

    1. Open database

    2. Read out some data

    3. Perform a backup

     

    If I do similar things it failed with that XNET error.
    During implementing the test program I found out that this:

     

    FDriverLink.DriverID   := 'FB';

     

    was in the code instead of this:

     

    FDriverLink.DriverID   := 'IB';

     

    I changed my real application now and guess what?
    It works! 😉

     

    Must have been a leftover from the times where dbExpress had been used
    and no FB driver existed yet.


  8. GetIt publication of a V2.1.1 has been done now, but one user from German DP reported some problem I cannot reproduce yet.

    I could install it via GetIt in 12.0 (had only Parnassus IDE plugins installed in that installation so far) and run it

    while he seemed to get some compilation error.

     

    Maybe somebody has a "plain"/"virgin" 11.x installation he can test on?

    Suspicion is that older Delphi versions require some Edge SDK stuff (as available in GetIt) isntalled which
    nowadays is included in RTL or so already...

     

    Enjoy

    TurboMagic


  9. Sigh! That was the idea of my own small backup/restore test app I developed using code from the main app. But when using that it always works 😞
    Ok, one thing is left to check: these auto reconnect options of the DB connection. But I doubt that's the issue, but need to check.


  10. Strange. When I call offline on the DB connection and then run the backup from the same application I get this xnet error.

    But when I call offline on the DB connection followed by exit as next statement and place a breakpoint on that, I can run
    that application so it stops on the exit statement and then perform a backup from a separate test application which uses
    the same code to perform the backup and the backup works.

     

    Why doesn't it work when I call that from the same application?


  11. Ok, I'm pleased too early: when trying to perform a backup with FB 4.0 while the DB Connection is open, it fails with
    an I/O error because the DB file is already open. 😞 And I also found out now that the cases where it worked were
    because of having installed and 4.0 FB server on the same VM for using a DB tool and having forgotten to turn
    off the service 😞

     

    With 2.5 embedded this wasn't a problem as far as I can remember.
    That would mean now, that I have to close the DB connection and close the DriverLink, then I can perform the
    backup and then I need to reopen the DB connection and what's more: all datasets I have, which pointed on this
    DB connection and which might be open at this point in time become invalid. I would have to recreate them all.

    Correct?

     

    Or is there a way I can perform a backup while still having an open DB connection using the embedded version
    of Firebird? I could understand for the Restore, but not for the Backup...
    And yes, the other option would be to not use Embedded but the regular client/server variant.


  12. Ok, I did the Firebird 4.0 Migration now and Backup/Restore basically work again. I've got something else in im application now when restoring,
    but that's something on my side.


  13. Here's the code used to initialize the restore component:
     

      FFBDriverLink             := TFDPhysFBDriverLink.Create(nil);
      FFBDriverLink.VendorLib   := 'D:\Projects\MyApp\Win32\Debug\Database\fbclient.dll';
      FFBDriverLink.Embedded    := true;
    
      FFBRestore                := TFDIBRestore.Create(nil);
      FFBRestore.ConnectTimeout := 0;
      FFBRestore.Database       := DatabaseFileName;
      FFBRestore.DriverLink     := FFBDriverLink;
      FFBRestore.Password       := c_DBPassword;
      FFBRestore.QueryTimeout   := 2;
      FFBRestore.UserName       := c_DBUserName;
      FFBRestore.Options        := [roReplace];
      FFBRestore.Protocol       := TIBProtocol.ipLocal;
    
      FFBRestore.Verbose        := true;
    
      FFBRestore.AfterExecute   := OnRestoreFinishedInternal;
      FFBRestore.OnProgress     := OnRestoreProgressInternal;
      FFBRestore.OnError        := OnRestoreErrorInternal;

     


  14. This is a problem already discussed in German DP:
    https://www.delphipraxis.net/214354-backup-problem-nach-umstellung-auf-v3-0-embedded.html
    but the hints I got from there weren't working yet or not exactly how I wanted things to work.

     

    I've got an application developed in Delphi 11.3 which used a Firebird V2.5 embedded database.
    Now I wanted to migrate it to a newer version (currently 3.0, but at the end 4.x is planned).

     

    The migration worked for the main part of the application, but it fails for the backup/restore menus

    in the application. The failure shown is:

     

    [FireDAC][Phys][FB]Unable to complete network request to host "xnet://Global\FIREBIRD".
    [FireDAC][Phys][FB]invalid service handle
    [FireDAC][Phys][FB]invalid service handle

     

    This is strange, because the same method for performing a restore is used in this application at startup
    when a database backup file is found which stems from an update of the application. That's needed to be
    able to move to a newer database file format verion (ODS in Firebird terms). In that scenario the restore is
    run before there was an open TFDConnection.

     

    The failure case happens when I invoke the restore menu in the application. But that one closes the connection
    first and after some modification even frees the connection and the DriverLink objects.

     

    I also created a separate small test application which just implements the restore using the unints from the
    main application. When I set a breakpoing in the main application on the close call of the DB connection, let
    that one get carried out and then halt the main application in the debugger the test application will present
    a different error thant the one described above.

     

    I modified the main application then to just close the connection in the restore menu and then do nothing more.
    Then I can run my separate test application and perform the restore.

     

    I also checked FDManager.ConnectionCount when I close that connection. Before it is 1 and after close it is 0,
    so there's no connection pooling used in that application.

     

    => what else can this be and why does it work, when running the restore before having opened any db connection?


  15. Hello,

     

    this is the information that a version 2.1 of Delphi Code Coverage Wizard Plus has been released today.

    It can be found here: https://github.com/MHumm/delphi-code-coverage-wizard-plus/releases/tag/V2.1
    and hopefully soon via Tools/GetIt package manager.

     

    What's new?

    • updated code coverage command line tool used
    • fixed duplicate accelerator keys on generate and run menu/page
    • added support for new -ecp class prefix exclusion parameter
    • added support for new -lcl parameter
    • added support for new -ife and -efe parameters
    • made Delphi 12.0 Athens known to the tool for IDE tools menu integration

     

    Enjoy

     

    TurboMagic

    • Like 1
    • Thanks 1

  16. Hello,

     

    when compiling my app (the Hash FMX demo from this project: DelphiEncryptionCompendium) with Delphi 12 for Android 32 bit debug mode
    I get this failure message, while the same thing just works in 11.3. Compiling the FMX cipher demo for Android with 12.0 works though
    (I just uploaded a new aab for app store publication).

     

    Looking at the failure messages I wonder where on earth I should have gotten > 65536 methods in this project?!
    My 12.0 installation is a standard one with the standard SDK/NDK and Java brought by the Delphi installation.

    [PAClient Fehler] Fehler: E7688 ""C:\Program Files\Eclipse Adoptium\jdk-11.0.15.10-hotspot\bin\java.exe" -cp "c:\program files (x86)\embarcadero\studio\23.0\bin\Android\r8-8.0.40.jar" com.android.tools.r8.D8 --release --min-api 19 --output "D:\Projekte\DECGitMaster\Compiled\BIN_IDExx.x_Android__Demos\Hash_FMX.classes" @"D:\Projekte\DECGitMaster\Compiled\BIN_IDExx.x_Android__Demos\dex_list.txt"" kann nicht ausgeführt werden (Fehler 1)
    [PAClient Fehler] Fehler: E7688 Picked up JAVA_TOOL_OPTIONS: 
    [PAClient Fehler] Fehler: E7688 Error: Cannot fit requested classes in a single dex file (# methods: 86037 > 65536). Try supplying a main-dex list
    [PAClient Fehler] Fehler: E7688 Compilation failed
    [PAClient Fehler] Fehler: E7688 Exception in thread "main" java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, position: null
    [PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.utils.N0.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:119)
    [PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.D8.main(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:5)
    [PAClient Fehler] Fehler: E7688 Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, position: null
    [PAClient Fehler] Fehler: E7688 	at Version.fakeStackEntry(Version_8.0.40.java:0)
    [PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.utils.N0.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:74)
    [PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.utils.N0.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:27)
    [PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.utils.N0.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:26)
    [PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.utils.N0.b(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:2)
    [PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.D8.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:26)
    [PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.D8.b(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:13)
    [PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.D8.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:24)
    [PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.utils.N0.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:106)
    [PAClient Fehler] Fehler: E7688 	... 1 more
    [PAClient Fehler] Fehler: E7688 Caused by: com.android.tools.r8.utils.b: Cannot fit requested classes in a single dex file (# methods: 86037 > 65536)
    [PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.utils.E2.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:21)
    [PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.utils.E2.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:26)
    [PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.dex.t0.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:228)
    [PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.dex.o0.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:9)
    [PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.dex.k.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:51)
    [PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.dex.k.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:157)
    [PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.D8.d(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:152)
    [PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.D8.c(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:1)
    [PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.utils.N0.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:23)
    [PAClient Fehler] Fehler: E7688 	... 6 more

     

    Anybody any clue about the reason for this and how to fix it?

     

    CHeers

    TurboMagic


  17. Ok, I have a solution now, thanks to Uwe's suggestion:
    If I use a DataSetWriter instead of a SQL one, I can assign a TFDTable component to that one, which has the TableName property
    and which calls OnNewRecord just fine. In that one can I check the table name and if it's one of the tables where not Null columns
    have been added later on, I can check these columns for 'not NULL' and assign a default value there.

     

    In my tests the DB functionality of having default values didn't work. Maybe the TFDBatchMove added NULL values itsself for
    these additional columns...

×