Last active
November 26, 2023 16:27
-
-
Save Yoticc/9a186f8cd37e91cae854d48b9d04fc05 to your computer and use it in GitHub Desktop.
Dnlib: Add custom attribute UnmanagedCallersOnly. How to add array field argument in CutsomAttribute.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var attbr = new CustomAttribute(module.Import(/*Ctor of UnmanagedCallersOnlyAttribute*/)); | |
attbr.NamedArguments.Add(new(true, module.CorLibTypes.String, "EntryPoint", new(module.CorLibTypes.String, /*entrypoint name, just string*/))); | |
attbr.NamedArguments.Add(new(true, /*System.Type[] TypeSig*/, "CallConvs", new(/*System.Type[] TypeSig*/, /*CallConv types, just Type[]*/.Select(t => new CAArgument(/*System.Type TypeSig*/, module.ImportAsTypeSig(t))).ToList()))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment