Einzelnen Beitrag anzeigen

Benutzerbild von geskill
geskill

Registriert seit: 17. Feb 2007
Ort: NRW
420 Beiträge
 
Delphi 2010 Professional
 
#7

AW: Interface von Delphi -> C++?

  Alt 22. Mär 2013, 15:40
Ich würde die Interfaces aber nicht nur für C++ verfügbar machen, sondern allgemeiner für COM, wie es hier auch schon andere gesagt haben.

Hier gibt es eine schöne Tabelle dazu: http://www.dynamsoft.com/help/TWAIN/...ataMapping.htm


Denn im oben genannten Thema ist das z.B. schon mit dem einfach Booleschen Datentypen problematisch (bool<->Boolean).

Delphi:
Zitat:
Eine Boolean-Variable belegt ebenso wie eine ByteBool-Variable ein Byte Speicherplatz. Eine WordBool-Variable belegt 2 (ein Word) und eine LongBool-Variable 4 Byte (zwei Word).
von Boolesche Typen

C++:
Zitat:
In Visual C++4.2, the Standard C++ header files contained a typedef that equated bool with int. In Visual C++ 5.0 and later, bool is implemented as a built-in type with a size of 1 byte. That means that for Visual C++ 4.2, a call of sizeof(bool) yields 4, while in Visual C++ 5.0 and later, the same call yields 1.
von bool (C++)

D.h. in C++ war ein Bool mal mit 4 Bytes definiert. Aber von C++ gibt es ja nicht nur das C++ aus Visual Studio, sondern auch einige freie Compiler. Dort kann der Datentyp noch ganz anders definiert sein. Sowas endet dann früher oder später im Chaos

Für die größte Kompatibilität immer COM nehmen und das heißt in diesem super simplen Beispiel WordBool nehmen


Der Nachteil an COM ist die Geschwindigkeit (reference counting), aber bei der heutigen Leistung eines PC spielt das keine Rolle mehr
Sebastian
  Mit Zitat antworten Zitat