in Education by
is it possible to call c# methods written in managed code (maybe in a class or a library) from a native c code (and how)? thx edit: with "c#" i mostly refer to mono or even portable.net and the OS is Linux JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Your C code can define functions to register callbacks. The C# code can P/Invoke these functions, and pass managed delegates as arguments. The marshalling code will transparently transform these to C function pointers. Alternatively, approaching it from the C side, you can use the Mono embedding API to load assemblies, look up MonoMethods, and invoke them. Using the embedding API is much more complicated. If your entry point is in C, you'll have to use the embedding API, but it's likely easier to simply write a managed method to do the callback registration and any other managed setup, then you only have to load and invoke that single method from C code.

Related questions

0 votes
    Which design pattern provides a single class which provides simplified methods required by client and delegates call to ... of Java Select the correct answer from above options...
asked Feb 22, 2022 in Education by JackTerrance
0 votes
    I want to execute HelloWorldConsole.exe with an shipped Mono Framework through Go. So I want to call mono- ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 17, 2022 in Education by JackTerrance
0 votes
    What are delegates in C# and the uses of delegates?...
asked Mar 31, 2021 in Technology by JackTerrance
0 votes
    What is Default interface methods in C#.Net?...
asked Dec 30, 2020 in Technology by JackTerrance
0 votes
    What is the difference between .NET Core and Mono?...
asked Feb 16, 2023 in Technology by JackTerrance
0 votes
    I am debugging a Service Fabric application and need to use a conditional breakpoint based on the value of ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 9, 2022 in Education by JackTerrance
0 votes
    The flow of nutrients in an ecosystem is (a) Non- cyclic (b) Mono directional (c) Reverse ... Science,Science proposed by,electromagnetic theory engineering physics,Science nptel...
asked Nov 7, 2021 in Education by JackTerrance
0 votes
    I would like to call a .net 4.0 dll from an IIS7 application that is running in a .net 2.0 ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 26, 2022 in Education by JackTerrance
0 votes
    Which stage needs to be used to call Business object Page from Process? a)Object b)Process c)Page d)Action...
asked Apr 29, 2021 in Technology by JackTerrance
0 votes
    ______________ are JS functions that you can call from your templates, and encourage you to reuse code and build complex templates a)Expressions b)Helpers c)Template d)Context...
asked Apr 29, 2021 in Technology by JackTerrance
0 votes
    How do I call Objective-C code from Swift?...
asked Mar 9, 2021 in Technology by JackTerrance
0 votes
    I want to import an oracle dump into a different tablespace. I have a tablespace A used by User A ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 30, 2022 in Education by JackTerrance
0 votes
    I want to import an oracle dump into a different tablespace. I have a tablespace A used by User A ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 29, 2022 in Education by JackTerrance
0 votes
    I'm interesting in reducing the size of .hg folder in my project. I have size of .hg folder near ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 28, 2022 in Education by JackTerrance
...