c2cs icon indicating copy to clipboard operation
c2cs copied to clipboard

Ability to remap pointer types

Open RandyPasion opened this issue 3 years ago • 2 comments

Currently remapping is only evaluated on element types (e.g. remapping someType will apply the same remapping to someType*)

Allow defining remapping of pointer types separately from element type.

This can be particularly useful for safe pointer management in C#. A common use case would be to remap someType* to a class inheriting SafeHandle (e.g. SomeTypeHandle : SafeHandle) that the user defines for managing the pointer.

Secondary improvement here - prioritize user remappings to defaults. Some types are default remapped ((char* to CString for example). If a user defines a different remapping from this, it should prefer the user's remapping.

RandyPasion avatar Oct 20 '22 21:10 RandyPasion

Makes sense; sounds like this would go well with the idea of trying to work on right now: C# plugin. Use a C# library to control generating C# code rather than a config file. This would help with automating custom wrappers as custom C# code can be written to help transform the bindings into a desired wrapper.

lithiumtoast avatar Oct 21 '22 02:10 lithiumtoast

I found a way forward to implement this. It requires some major refactoring however... I'll be working on it when I can.

lithiumtoast avatar Oct 25 '22 13:10 lithiumtoast