jbevain / cecil

Cecil is a library to inspect, modify and create .NET programs and libraries.
MIT License
2.77k stars 630 forks source link

Add importing of netmodule #819

Open kant2002 opened 2 years ago

kant2002 commented 2 years ago

Closes #818

jbevain commented 2 years ago

Hi @kant2002! Thank you for your PR!

Is this an actual case you're hitting? While the code seems to make sense, could you add tests for it?

Thanks!

kant2002 commented 2 years ago

@jbevain I was hitting that in the actual snippet which I wrote in the issue. That snipped was created by @fornever when he play with C compiler in .NET. He probably can explain more.

Regarding tests, what's proper place to add test for this case? I was looking for them, but I cannot find nice place where I can validate case.

jbevain commented 2 years ago

Hey!

The place to add a test would be there:

https://github.com/jbevain/cecil/blob/master/Test/Mono.Cecil.Tests/ImportCecilTests.cs

Thanks!

ForNeVeR commented 2 years ago

That snipped was created by @ForNeVeR when he play with C compiler in .NET. He probably can explain more.

This was an experiment while I was investigating how to create/use a .netmodule file using Cecil (in a project where I'm trying to create a fully C17-compatible compiler using Cecil, among other tools).

Initially, I wanted to mimic the full C-style compilation: creating a separate .netmodule for every translation unit, and then linking them together using the .NET assembly linker (al.exe, IIRC).

Though right now I've deserted this approach (not because of any Cecil problems, but because I don't think it's appropriate). So, there are no any actual uses of .netmodules in my code at the moment.

It not impossible I'll decide to play with them again later, but not too likely, either.

kant2002 commented 2 years ago

@jbevain I think this is ready for another round of review.

kant2002 commented 11 months ago

@jbevain New year is soon. I behave well, so may I have some present on New Year, or on Christmas ?