AdvancedDLSupport icon indicating copy to clipboard operation
AdvancedDLSupport copied to clipboard

Add interface-wide default calling convention

Open sunkin351 opened this issue 6 years ago • 4 comments

NativeSymbolsAttribute updated to have a specifiable interface-wide calling convention, along with internal logic to accommodate.

sunkin351 avatar Jul 01 '19 03:07 sunkin351

Codecov Report

Merging #87 into master will decrease coverage by 0.09%. The diff coverage is 61.11%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master      #87     +/-   ##
=========================================
- Coverage   89.44%   89.35%   -0.1%     
=========================================
  Files         114      114             
  Lines        5516     5532     +16     
  Branches      456      461      +5     
=========================================
+ Hits         4934     4943      +9     
- Misses        576      583      +7     
  Partials        6        6
Impacted Files Coverage Δ
...ransformation/Attributes/NativeSymbolsAttribute.cs 44.44% <ø> (ø) :arrow_up:
...cedDLSupport/Reflection/IntrospectiveMemberBase.cs 75% <61.11%> (-4.17%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 7ab2c03...e238fce. Read the comment docs.

codecov[bot] avatar Jul 01 '19 18:07 codecov[bot]

Codecov Report

Merging #87 into master will decrease coverage by 2.26%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #87      +/-   ##
==========================================
- Coverage   89.09%   86.83%   -2.27%     
==========================================
  Files         115      116       +1     
  Lines        5642     5584      -58     
  Branches      497      463      -34     
==========================================
- Hits         5027     4849     -178     
- Misses        604      717     +113     
- Partials       11       18       +7
Impacted Files Coverage Δ
...ancedDLSupport/Attributes/NativeSymbolAttribute.cs 100% <ø> (ø) :arrow_up:
...ransformation/Attributes/NativeSymbolsAttribute.cs 44.44% <ø> (ø) :arrow_up:
...cedDLSupport/Reflection/IntrospectiveMemberBase.cs 80% <100%> (-0.56%) :arrow_down:
....Tests/Tests/Integration/CallingConventionTests.cs 100% <100%> (ø)
AdvancedDLSupport/Loaders/LinuxPlatformLoader.cs 0% <0%> (-100%) :arrow_down:
AdvancedDLSupport/Loaders/BSDPlatformLoader.cs 0% <0%> (-100%) :arrow_down:
AdvancedDLSupport/Loaders/Native/dl.cs 5.88% <0%> (-82.36%) :arrow_down:
AdvancedDLSupport/Loaders/UnixPlatformLoader.cs 10.81% <0%> (-78.38%) :arrow_down:
...vancedDLSupport/PathResolvers/MacOSPathResolver.cs 16.66% <0%> (-58.34%) :arrow_down:
...vancedDLSupport/PathResolvers/LinuxPathResolver.cs 20% <0%> (-42.86%) :arrow_down:
... and 14 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update dd003ff...df98ed7. Read the comment docs.

codecov[bot] avatar Jul 01 '19 18:07 codecov[bot]

So based on some of the discussions on github, here's an outline of the test cases that need to be implemented:

Case 1

  • Interface only
  • Single method without explicit calling convention
  • Calling convention set in NativeSymbols attribute on the interface

Expected Results

Method uses the calling convention from the NativeSymbols attribute and can be successfully called.

Case 2

  • Interface only
  • Two methods
    • Method one does not have an explicit calling convention set
    • Method two has an explicit calling convention set via a NativeSymbol attribute

Expected Results

Method one uses the calling convention from the NativeSymbols attribute. Method two uses the calling convention set in its specific NativeSymbol attribute.

Case 3

  • Mixed-mode class
  • Multiple interface implementation
  • Interface one has a NativeSymbols attribute
  • Interface two does not

Expected Results

Methods from interface one uses the calling convention from the NativeSymbols attribute on their interface. Methods from interface two does not.

Case 4

  • Mixed-mode class
  • Multiple interface implementation
  • Interface one has a NativeSymbols attribute
  • Interface two has a NativeSymbols attribute with a different calling convention.

Expected Results

Methods from interface one uses the calling convention from the NativeSymbols attribute on their interface. Methods from interface two uses the calling convention from the NativeSymbols attribute on their interface.

Nihlus avatar Jul 02 '19 16:07 Nihlus

Can you rebase this on master and ensure the tests pass before I review it?

Nihlus avatar Sep 21 '19 09:09 Nihlus