Walter Bright wrote:
Now that DMD has broken the ABI on x86_64,

??

... compared with GDC, that was.

Think we discussed this earlier, it's about the
passing of structs as parameters compared with C++.

The code is passing a D "string" to the C++ side,
and then interpreting this C argument as a struct:

/// length-prefixed string in UTF-8 format
struct dstr {
        size_t          length;
        const char*     data;
};

This only works in 32-bit code, and not in 64-bit.
Need to use two separate .length and .ptr pairs.


It should probably pass around wxString() objects
instead, even if that's slightly less convenient...

So instead of:

static extern (C) void wxApp_SetAppName(IntPtr self, string name);
        static extern (C) IntPtr wxApp_GetAppName(IntPtr self);

public string AppName() { return cast(string) new wxString(wxApp_GetAppName(wxobj), true); }
        public void AppName(string name) { wxApp_SetAppName(wxobj, name); }

It should do:

static extern (C) void wxApp_SetAppName(IntPtr self, IntPtr name);
        static extern (C) IntPtr wxApp_GetAppName(IntPtr self);

        public wxString AppName() { return wxApp_GetAppName(wxobj); }
public void AppName(wxString name) { wxApp_SetAppName(wxobj, name); }

Then it will be more explicit *when* strings are created,
especially if any UTF conversion needs to be done by it.

--anders

Reply via email to