Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cecil. Meta library. Incorrect default values #16

Closed
3F opened this issue Oct 3, 2016 · 2 comments
Closed

Cecil. Meta library. Incorrect default values #16

3F opened this issue Oct 3, 2016 · 2 comments
Labels
Milestone

Comments

@3F
Copy link
Owner

3F commented Oct 3, 2016

whoops... current default values are not correct for DllExportAttribute, because today this used only with CustomAttribute -> ConstructorArguments

just noticed -_-

i.e. all below will not work (usage to initialize):

public DllExportAttribute(string function)
    : this(function, CallingConvention.Cdecl)
{
    ...
}

...

public CallingConvention CallingConvention
{
    get;
    set;
} = CallingConvention.Cdecl;

....

public DllExportAttribute()
{
    CallingConvention = CallingConvention.Cdecl;
}

etc.

ok, I'll fix it coming soon

@3F 3F added the bug label Oct 3, 2016
@3F
Copy link
Owner Author

3F commented Oct 3, 2016

  IL_0001:  ldarg.0
  IL_0002:  ldc.i4.2
  IL_0003:  call      
----
    IL_0000:  ldarg.0
    IL_0001:  ldc.i4.2
    IL_0002:  stfld    

samples:

.method public hidebysig instance void  Init() cil managed
{
  // Code size       10 (0xa)
  .maxstack  8
  IL_0000:  nop
  IL_0001:  ldarg.0
  IL_0002:  ldc.i4.2
  IL_0003:  call       instance void D3F00FF1770DED978EC774BA389F2DC901F4.B00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.C00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.D00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.E00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.F00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.DllExportAttribute::set_CallingConvention(valuetype [mscorlib]System.Runtime.InteropServices.CallingConvention)
  IL_0008:  nop
  IL_0009:  ret
}
.field private valuetype ['mscorlib']'System.Runtime.InteropServices'.'CallingConvention' '<CallingConvention>k__BackingField'

.method public hidebysig specialname instance valuetype ['mscorlib']'System.Runtime.InteropServices'.'CallingConvention' 
        'get_CallingConvention'() cil managed
{
  .custom instance void ['mscorlib']'System.Runtime.CompilerServices'.'CompilerGeneratedAttribute'::.ctor() = ( 01 00 00 00 ) 
  // Code size       7 (0x7)
  .maxstack  8
  IL_0000:  ldarg.0
  IL_0001:  ldfld      valuetype ['mscorlib']'System.Runtime.InteropServices'.'CallingConvention' 'TestForDllExport'.'DllExportAttribute'::'<CallingConvention>k__BackingField'
  IL_0006:  ret
}

.method public hidebysig specialname rtspecialname 
        instance void  .ctor() cil managed
{
  // Code size       16 (0x10)
  .maxstack  8
  IL_0000:  ldarg.0
  IL_0001:  ldc.i4.2
  IL_0002:  stfld      valuetype ['mscorlib']'System.Runtime.InteropServices'.'CallingConvention' 'TestForDllExport'.'DllExportAttribute'::'<CallingConvention>k__BackingField'
  IL_0007:  ldarg.0
  IL_0008:  call       instance void ['mscorlib']'System'.'Attribute'::.ctor()
  IL_000d:  nop
  IL_000e:  nop
  IL_000f:  ret
}

@3F
Copy link
Owner Author

3F commented Oct 3, 2016

.ctor above is more clear. Now, to set values by default inside metalib:

public CallingConvention CallingConvention
{
    get;
    set;
} = CallingConvention.Cdecl;

https://github.com/3F/DllExport/blob/master/Metadata/DllExportAttribute.cs

@3F 3F added this to the v1.4 milestone Oct 3, 2016
@3F 3F closed this as completed Oct 4, 2016
3F added a commit that referenced this issue Oct 5, 2016
    * FIXED: Fixed bug - `An item with the same key has already been added`. Issue #10
    * FIXED: Bug with Meta library: Incorrect default values. Issue #16
             please note, the __cdecl is the default calling convention for our library
             as and for C and C++ programs.

    * FIXED?: Probably fixed bug - `Script errors on package install` Issue #6
    * FIXED?: Probably fixed bug - `non-English system language - syntax error` Issue #7
    * NEW: GUI Configurator with updated ddNS features.
    * NEW: Implemented feature 'Export for platform': [ x86 / x64 / x86 + x64 ] Issue #9
    * NEW: Implemented feature 'Base for ordinals'. Issue #11
           There is also alternative to configure this number - MSBuild property: DllExportOrdinalsBase

    * NEW: The one (1) now is used by default as Base for all ordinals.
           `Mimic ordinal counter (start from 1 instead of 0)` Issue #8

    * CHANGED: The ddNS features now as binary cmdlet `NSBin`. Use `nsbin.bat` if needed.
    * CHANGED: `Set "Inherited = false" in AttributeUsage for DllExportAttribute`. Issue #15
    * OTHER: other possible changes and fixes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant