5 ms·
Yes, but none of that would need to change. I hate to keep harping on Object Pascal, but it really is a nice implementation: in OP, you can pass a string to a
by TimJYoung 8y ago
Yes, but none of that would need to change. I hate to keep harping on Object Pascal, but it really is a nice implementation: in OP, you can pass a string to a C API, such as the Windows APIs, like this:
Result:=CreateFile(pChar(FileName),
AccessMode,ShareMode,nil,
OpenFlags,AttrFlags,0);
where FileName is a String and pChar is the more traditional C-style pointer to an array of characters. The compiler will prevent you from passing a Unicode/Wide string to an API call that expects an ANSI string pointer, or vice-versa. So, interop with the system-level APIs of Windows or Linux is seamless and easy.
- TimJYoung 8y agoBTW, I almost forgot to mention: the String type in Object Pascal implicitly contains a NULL terminator, so the above call is zero-copy. More information: http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Internal_Data_Formats_(Delphi) http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Internal_D... under "Long String Types".