AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Programmieren allgemein DLL mit Strings von D10 nach Delphi 6
Thema durchsuchen
Ansicht
Themen-Optionen

DLL mit Strings von D10 nach Delphi 6

Ein Thema von kmma · begonnen am 25. Okt 2023 · letzter Beitrag vom 27. Okt 2023
 
Kas Ob.

Registriert seit: 3. Sep 2023
393 Beiträge
 
#10

AW: DLL mit Strings von D10 nach Delphi 6

  Alt 26. Okt 2023, 08:19
Hi,

Is this acceptable to be solved by a hack ?

As i think it is doable but with little hacking around, see the the string structure is different, but we can utilize the fact of how Delphi handle constant (literal) strings, if the reference count is -1 ($FFFFFFFF) then it will always copy it, so in theory which i see doable, you have to overwrite and adjust your returned string to have the same structure as Delphi 6.
so the steps should be like:

1) in Delphi 10 and when the result is ready to returned, a copy of the pointer is stored in a garbage collecting list, this is crucial because we need to fix it later and release the memory preventing leak and corruption in the DLL.
2) rewrite the structure to be compatible with Delphi 6, means overwrite the 16bit "codePage" and "elemSize" as one cardinal 32bit, with value $FFFFFFFF (-1), and put the length in refCount.
3) now Delphi 6 should copy all the returned strings to its own allocated strings, as it will see them as constants.
4) we need an entry point to clean the garbage, it could be the first line in every call to DLL in Delphi 10, to restore the string refcount and assign it to an empty string ''.

This is working in my head and before writing code to demonstrate it and waste time, i would know if this is acceptable, also i don't have now an access to Delphi 6 or 7 to test it with a debugger.

On side note : i saw somewhere that himitsu has a unique love/hate for garbage collectors in Delphi, and i would love to hear your opinions.
Kas
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 06:04 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz