For the dotnet target, we should allow and handle the use of the DllImportAttribute to describe native interop functions.
This should be straight-forward as Oly has a way to describe an attribute as an import attribute which means we do not have provide an implementation for that function.
Thus, when importing DllImportAttribute in the MSIL => OlyIL conversion, we should add a heuristic for DllImportAttribute to be marked as an import attribute. Then, in the emitter we appropriately handle the DllImportAttribute to turn it into a pinvoke method. We already have some code that can do this, we just need to enable it and handle it further.
Note: Consider adding analysis to make sure DllImportAttribute is not mis-used.
For the
dotnettarget, we should allow and handle the use of theDllImportAttributeto describe native interop functions.This should be straight-forward as Oly has a way to describe an attribute as an
importattribute which means we do not have provide an implementation for that function.Thus, when importing
DllImportAttributein theMSIL => OlyILconversion, we should add a heuristic forDllImportAttributeto be marked as animportattribute. Then, in the emitter we appropriately handle theDllImportAttributeto turn it into a pinvoke method. We already have some code that can do this, we just need to enable it and handle it further.Note: Consider adding analysis to make sure
DllImportAttributeis not mis-used.