Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Can wchar_t be safely past to a dll?



Permlink Replies: 1 - Last Post: Jan 16, 2018 1:58 PM Last Post By: Remy Lebeau (Te...
Brake Cane

Posts: 1
Registered: 2/14/18
Can wchar_t be safely past to a dll?
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 14, 2018 8:48 AM
I am using XE4 32bit VCL for windows application. The message below appears at the top of a dll and does not reference the wide string type wchar_t. Can the wchar_t be used the same as the char type described below?
// Important note about DLL memory management when your DLL uses the
// static version of the RunTime Library:
//
// If your DLL exports any functions that pass String objects (or structs/
// classes containing nested Strings) as parameter or function results,
// you will need to add the library MEMMGR.LIB to both the DLL project and
// any other projects that use the DLL. You will also need to use MEMMGR.LIB
// if any other projects which use the DLL will be performing new or delete
// operations on any non-TObject-derived classes which are exported from the
// DLL. Adding MEMMGR.LIB to your project will change the DLL and its calling
// EXE's to use the BORLNDMM.DLL as their memory manager. In these cases,
// the file BORLNDMM.DLL should be deployed along with your DLL.
//
// To avoid using BORLNDMM.DLL, pass string information using "char *" or
// ShortString parameters.
//
// If your DLL uses the dynamic version of the RTL, you do not need to
// explicitly add MEMMGR.LIB as this will be done implicitly for you
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Can wchar_t be safely past to a dll?
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 16, 2018 1:58 PM   in response to: Brake Cane in response to: Brake Cane
Brake Cane wrote:
I am using XE4 32bit VCL for windows application. The message below appears at the top of a dll and does not reference the wide string type wchar_t.

The message talks about the String type, which is UnicodeString in XE4. The message text is old, dating back to the pre-Unicode days, but what it says applies equally to AnsiString and UnicodeString.

Can the wchar_t be used the same as the char type described below?

Yes. You can use char* to pass 8-bit string data, and use wchar_t* to pass 16bit string data.

--
Remy Lebeau (TeamB)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02