-
Notifications
You must be signed in to change notification settings - Fork 526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should CS_OUT std::string work? #263
Comments
@tritao - If you can point me in the right direction on this I can spend some time and submit a PR to implement it. Just looking for some guidance on how this should work. |
Have you tested regular The What I suggest is that you export a method returning a Regardless, we probably need to modify the |
I haven't. Mostly because it already does a fine job with I'll give it a shot and report back.
Oh... so they were not intended to work outside of C++ CLI. I didn't know that at all.
I wish it was that easy. In this case it is a static API that copies string data into a buffer provided by the caller.
I'll first see if I can first setup the correct mapping manually and then look to make it work automatically. |
So they don't work at all.... not that I needed them really. My issue was just one of
So I tired for a bit to make I went ahead and made my API use a class instance which could then hold the temporary memory needed to have non-const return strings. This solved the issue for now. |
Is this not working 10 years later (2024)? My code-generated method looks like this: public bool ExamineVariable(string variableName, ref string value, ref string response)
{
var __basicString0 = new global::Std.BasicString<sbyte, global::Std.CharTraits<sbyte>, global::Std.Allocator<sbyte>>();
global::Std.BasicStringExtensions.Assign(__basicString0, variableName);
var __arg0 = __basicString0.__Instance;
var __basicString1 = new global::Std.BasicString<sbyte, global::Std.CharTraits<sbyte>, global::Std.Allocator<sbyte>>();
global::Std.BasicStringExtensions.Assign(__basicString1, value);
var __arg1 = __basicString1.__Instance;
var __basicString2 = new global::Std.BasicString<sbyte, global::Std.CharTraits<sbyte>, global::Std.Allocator<sbyte>>();
global::Std.BasicStringExtensions.Assign(__basicString2, response);
var __arg2 = __basicString2.__Instance;
var ___ret = __Internal.ExamineVariable(__Instance, __arg0, __arg1, __arg2);
value = global::Std.BasicStringExtensions.Data(__basicString1); // Added this line to code-generated file
response = global::Std.BasicStringExtensions.Data(__basicString2); // Added this line to code-generated file
__basicString0.Dispose();
__basicString1.Dispose();
__basicString2.Dispose();
return ___ret;
} I had to add the lines above (with the Is there something I can do to generate this file correctly (with the lines added) or is this functionality still not implemented? |
The issue is still open, so I think so, apparently no one has cared enough to look into it and send a PR. |
I just tried to do this...
... it results in the following binding with an error:
That seems like it should be supported.
Is the bug in the the
Std.String
implementation not having aSystem.IntPtr
cast?Second question... why not have it generate the function with
string
instead and only useStd.String
for the conversion? Like this...The text was updated successfully, but these errors were encountered: