Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

exposing C# methods to unmanaged

Tags:

c#

.net

il

that approach in "possible duplicate" is different to the one in the book. The book's approach is to extend a managed .dll after compilation through a decompile, recompile process. The approach that you think is an exact duplicate is actually a pre compilation technique. I prefer method in the book because it is more AOP in style. Thanks for the link though. I will also explore this avenue

In Expert .NET 2.0 IL Assembler, in Ch 18 pp. 387 Serge Lidin talks about Creative Round-Tripping. He says, "ILAsm allows you to export the managed methods as unmanaged entry points".

I haven't heard this talked about anywhere else. Is this something that you can do in PostSharp? Are there any downloadable code / script examples of using this technique available?

To clarify, I don't want to use COM or Managed C++. So what's the best way to implement a call to a C# method from C/C++ through thunking?

like image 575
sgtz Avatar asked Mar 22 '12 12:03

sgtz


People also ask

What is C log in canon?

Canon Log is a staple feature in Canon's Cinema EOS range and is designed to deliver an 800 percent increase in dynamic range, minimising the loss of detail in the darkest and brightest parts of the image.


1 Answers

ildasm, change corflags, add v-table info and export function, ilasm and you're done.

Here's a code project article: http://www.codeproject.com/Articles/37675/Simple-Method-of-DLL-Export-without-C-CLI

Which is based on:

Dead link: http://www.csharphelp.com/2007/03/exporting-managed-code-as-unmanaged/

Wayback Machine for dead link: https://web.archive.org/web/20140213030149/http://www.csharphelp.com/2007/03/exporting-managed-code-as-unmanaged/

Which is based on: http://www.amazon.com/Inside-Microsoft-NET-IL-Assembler/dp/0735615470 (the first edition of the book you refer to)

like image 112
Eric Dahlvang Avatar answered Oct 31 '22 16:10

Eric Dahlvang