In newer versions of ILAsm, you can simply:
.method public static void Foo () { .export [1]
This exports Foo to index 1 in the export table. Export ordinals must be unique and consistent.
In older versions you will need:
.data vt = int32 (0) [n] .vtfixup [n] int32 fromunmanaged at vt .method public static void Foo () { .vtentry 1:1 .export [1]
(Where "n" is the amount of export you want.)
.vtentry indicates which vtable: slot to store the in method. (Table identifiers are sequential and therefore depend on the order of declaration.)
New ILAsms do all this for you, provided that you are not using the export table for anything else.
Note that all this is very disproportionate.
user438034
source share