0

I am basically .net developer and having zero knowledge on c. Today i got below task. There is a c program to add two numbers. C program contains method which takes two numbers to add as parameters. Now I want to access these c methods(objects) in my .net MVC or webapi2. I should call c program(object) to add two numbers and should give output in HTML using .net. I have no idea where to start this! Can someone educate me on this or someone share me usefull links to in order to understand in better way. Any help would be greatly appreciated. Thank you.

7
  • I think what you're looking for is COM (component object model). Or it might be Windows Communication Foundation. Or they might be asking for a simple exec type thing Commented Dec 7, 2017 at 4:09
  • Two suggestions: narrow your question down, and show a little bit of research effort. First issue I believe is: how do you call a C library from C#? What have you tried? What is not working? Show us some code. Commented Dec 7, 2017 at 4:10
  • Thanks for suggestions and feedback. I have not tried anything. By looking above comments I understood there are two ways to do this. First one is com second one is as you said call c library from c#. So these both ways works? Commented Dec 7, 2017 at 4:14
  • What format is the "C program" or "c methods (objects)"? Is it an executable, or are you calling a library (I assumed library, but perhaps I'm wrong)? If you need to call an executable, have a look at Process.Start() with parameters. There are a few different ways to call things outside of managed code, but it largely depends on what you are trying to call. Need more info. Commented Dec 7, 2017 at 4:26
  • Thanks pcdev. Let's say c library I want to access. Commented Dec 7, 2017 at 4:29

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.