1. I'm not sure, which types i should use for exported library methods in order to provide compatibility
for C++ (or C#) host applications running under windows and Linux. Especially for UTF-16 strings.
I can create some packed record that will use ctypes and Pwidechar for strings.
In principle, yes, though you need to be aware that on non-Windows
wchar_t is generally 4 Byte and thus UTF-32 instead of 2 Byte and UTF-16. Thus you can't simply return a
PWideChar (which is always for UTF-16) and handle that as a
wchar_t if you want to support *nix.
C++ host application will pass pointer to memory that contain structure, i should be able to use it from pascal library, right?
But how to return complicated result like record with UTF-16 strings from exported pascal library method to C++ host application?
You need to make sure that the same module that allocated something is the one that frees it. So either the application provides your library with a buffer and size and you complain if the buffer size is too small (preferably returning the new size) or you allocate the buffer yourself and also provide a function for the application to free your buffer again.
2. What if host application will be another C++ library rather than exe?
In that case, can pascal still return compilated record with utf-16 strings?
It doesn't matter if the caller is an executable or a library from the point-of-view of your own library it's the same: it's external code.