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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating minimal unsafe bindings for pure C lib #989

Open
raizam opened this issue Oct 20, 2017 · 4 comments
Open

Generating minimal unsafe bindings for pure C lib #989

raizam opened this issue Oct 20, 2017 · 4 comments
Labels

Comments

@raizam
Copy link

raizam commented Oct 20, 2017

I have a pure C library with structs and functions.

I just want to generate minimal bindings without any encapsulation and handle the higher level myself.
I'm looking for this kind of layout:

internal static class ModuleName
{
[DllImport( CallingConvention = CallingConvention.Cdecl)]
internal static unsafe extern CFunction(ref byte* ptr);

}

Having read the availlable docs, it's not clear to me how to achieve this

@realvictorprm
Copy link
Contributor

realvictorprm commented Oct 20, 2017 via email

@ddobrev
Copy link
Contributor

ddobrev commented Oct 20, 2017

@raizam I am not sure what the problem here is. You get more types in your bindings than you need?

@raizam
Copy link
Author

raizam commented Oct 20, 2017

The problem is that everything gets encapsulated in class Internal. This is a low level C library and I don't want to get high level C# implementation.
Also, cppsharp is not aware about memory ownship of the library and generates a lot of undesired behavior, like Dictionnary mappings between managed/native instances.

And strangely the generated binding shows some mangled c++ functions names while there aren't any.

Anyway...don't bother with this, I'm writing my own parser dedicated for this library

@tritao
Copy link
Collaborator

tritao commented Oct 20, 2017

You can easily extend CppSharp to get this functionality. We've had some requests over the years for this and would gladly add it, but so far no one has contributed an actual PR for it.

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

No branches or pull requests

4 participants