bottlenoselabs / c2cs

Generate C# bindings from a C header.
MIT License
245 stars 18 forks source link

Add CallingConvention to DllImport #68

Closed waldnercharles closed 2 years ago

waldnercharles commented 2 years ago

Some key learnings: If you want the calling conventions to appear correctly in DllImport, -m32 needs to be passed to clangArguments in the config. I couldn't find proper documentation, but, all signs point to DllImport ignoring the CallingConvention when the library being loaded is 64-bit.

I considered forcing -m32 to be passed into clang by default, but wasn't sure what side effects that might have.

waldnercharles commented 2 years ago

It might be wise to add the information about passing -m32 to clang via the .config to the readme or documentation somewhere. Not sure where the best place for that is.

lithiumtoast commented 2 years ago

Okay, I can experiment with this.