Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable string Marshaller usage in C# #1818

Open
bmassemin opened this issue Dec 30, 2023 · 2 comments
Open

Disable string Marshaller usage in C# #1818

bmassemin opened this issue Dec 30, 2023 · 2 comments

Comments

@bmassemin
Copy link

Brief Description

馃憢 Is there a way to disable the usage of a string marshaller in C#?
I would like to provide my string pointer directly to the native call.
Thanks 馃檹

OS: Windows

@deadlocklogic
Copy link
Contributor

deadlocklogic commented Dec 30, 2023

This should work:

public void SetupPasses(Driver driver)
{
    TypeMapDatabase.TypeMapsByKind(driver.Context.TypeMaps.GlobalTypeMaps, GeneratorKind.CSharp).Remove("basic_string<char, char_traits<char>, allocator<char>>");
}

It just disable the C# string typemap, but not totally sure about its usage.

@bmassemin
Copy link
Author

bmassemin commented Dec 30, 2023

I've overridden the const char* typemap and now I can use an IntPtr.
But now I would like to be able to use a byte* instead. It works, but the generated struct still have an __IntPtr type, I'm not sure how to tell CppSharp to use byte* for const char*.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants