Question

I just recently found out about the ALink API which presumably is the backend for tools like Al.exe and corflags.exe.

The API is fully documented in MSDN and has some very useful functions such as SetPEKind which allows you to modify the CorFlags of an assembly programmatically:

http://msdn.microsoft.com/en-us/library/ms230159(v=vs.110).aspx

However, it's not entirely clear how we get to use this API. Does anyone have any examples? I'm assuming that it must be possible, given that Microsoft went to the trouble of publicly documenting it.

Était-ce utile?

La solution

The C# compiler uses it. You couldn't get a better example, I think. Download SSCLI20 and look in the csharp/sccomp subdirectory. You'll find the compiler.cpp source code file creating the instance of the interface and storing it in the linker variable. Now searching for "linker" gets you all the places where the interface methods are used.

Of course do keep in mind that it wasn't made to change an existing assembly. It was made to create a new assembly from scratch. Corflags.exe doesn't use it.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top