It may be best to convert part or all of it to C#. Since C# is managed code, you will be able to simplify the code by removing memory management code such as ALLOC.
Click "Mark as Answer" on the post that helped you.
This earns you a point and marks your thread as Resolved so we will all know you have been helped.
FAQ on the correct forum http://forums.asp.net/p/1337412/2699239.aspx#2699239
RobertLair
Member
152 Points
34 Posts
Compile C Programs as .NET
Mar 07, 2009 11:56 PM|LINK
Is it possible to take a C program and compile it with VS.NET and then use it just as you would another .NET compiled application, such as C#?
Robert Lair
http://blog.robertlair.net
pkellner
All-Star
24042 Points
3625 Posts
ASPInsiders
Moderator
MVP
Re: Compile C Programs as .NET
Mar 08, 2009 06:59 PM|LINK
you have to enable unsafe mode in .net and use pinvoke kind of stuff. Here is some pointers on that.
http://msdn.microsoft.com/en-us/library/2x8kf7zx(VS.80).aspx
http://peterkellner.net
Microsoft MVP • ASPInsider
TATWORTH
All-Star
72415 Points
14017 Posts
MVP
Re: Compile C Programs as .NET
Mar 08, 2009 08:39 PM|LINK
What sort of C program is it?
It may be best to convert part or all of it to C#. Since C# is managed code, you will be able to simplify the code by removing memory management code such as ALLOC.
This earns you a point and marks your thread as Resolved so we will all know you have been helped.
FAQ on the correct forum http://forums.asp.net/p/1337412/2699239.aspx#2699239
Tanaka Hiero
Member
47 Points
15 Posts
Re: Compile C Programs as .NET
Apr 21, 2013 08:11 PM|LINK
You can't use C code directly within .NET.
You have a couple of options:
Compile the C code into a dynamic link library, and use P/Invoke in order to call it from your .NET program.
Port the C code to .NET.
Wrap the C code using C++/CLI (making a mixed mode assembly), and use these from within your other .NET language of choice