monkey0506 / native-generic-delegates

Generic C# delegates for P/Invoke.
Other
8 stars 0 forks source link

Implement runtime fallbacks feature #26

Closed monkey0506 closed 1 month ago

monkey0506 commented 1 month ago

This PR will implement the Runtime fallbacks feature as described in #21, and fixes #24.

Runtime fallbacks

monkey0506 commented 1 month ago

I had remembered the way that the incremental-generator branch was caching the MarshalAsAttribute parameters incorrectly. That branch still required these parameters to be compile-time constant expressions, because, of course, the implementation class has to be able to produce those attributes in the generated source code. The CallingConvention can be handled at runtime, but the marshalling will still have to be handled in the same way.

There might be more opportunities to expand on what values are permitted (e.g., reading a value set in a static constructor), but for now this PR is defunct. A new PR will be made for the CallingConvention changes.