mono / CppSharp

Tools and libraries to glue C/C++ APIs to high-level languages
MIT License
3.13k stars 516 forks source link

Is there a way to only generate the PInvoke functions? #1669

Open TheButlah opened 2 years ago

TheButlah commented 2 years ago

I'm using cppsharp but only using the static functions in generated.__Internal - none of the wrappers cppsharp generates handle the ownership semantics I'm exposing in my C library. I'd like to get cppsharp to only provide the actual static extern functions and C structs.

Also, is there a way to have cppsharp stop changing the name of these functions? I have a particular use of __ and cppsharp removes them or changes them to only 1 underscore

tritao commented 2 years ago

At the moment there is no builtin support to only generate the C P/invoke structs and signatures.

Where does CppSharp rename the functions in the generated code? Is it just at the C# wrapper level or does it also change the symbol name at P/Invoke/DllImport level?

TheButlah commented 2 years ago

It also changes it at the PInvoke level. for example:

[SuppressUnmanagedCodeSecurity, DllImport("tp_client", EntryPoint = "tp_client__baseline__Baseline__state_mut_U64", CallingConvention = __CallingConvention.Cdecl)]
internal static extern __IntPtr TpClientBaselineBaselineStateMutU64(__IntPtr b, __IntPtr state);