Avoid pinning this
in instance method for struct COM objects
#972
Labels
enhancement
New feature or request
this
in instance method for struct COM objects
#972
Overview
I'm trying out CsWin32 with the
"allowMarshaling": false
mode enabled, which generates blittable struct types for all COM types, instead of interfaces. That is great, but I noticed the generated code is leaving a bit of performance on the table. Specifically:This is an example, but the same applies to all instance methods across all generated types. Pinning
this
is actually not needed, because the actual value will always be on native memory (since users would always just receive a pointer to a native COM object).We can improve this by instead generating:
Open questions
Unsafe.AsPointer
is available on the target project (which can be checked easily enough).Context
0.3.2-beta
LangVersion
(if explicitly set by project): 11The text was updated successfully, but these errors were encountered: