473,395 Members | 2,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Co to C# converter?

I want to use C code libraries within a C# application. Besides
creating a separate DLL for the C code and calling the DLL from the C#
app, is there any kind of converter out there for creating C# code
out of C code?

Regards,

Jon G

Sep 18 '06 #1
6 12494
You may be able to compile your C code in a Visual Studio.NET C++ project
with the /CLR switch and it will be compiled into a .NET managed assembly.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Jon Gabel" wrote:
I want to use C code libraries within a C# application. Besides
creating a separate DLL for the C code and calling the DLL from the C#
app, is there any kind of converter out there for creating C# code
out of C code?

Regards,

Jon G

Sep 18 '06 #2
Hello Jon,

I don't think that u find any kind of C to C# convertors.
Languages are too different as in syntas as in design. There is nothing to
convert.

JGI want to use C code libraries within a C# application. Besides
JGcreating a separate DLL for the C code and calling the DLL from the
JGC# app, is there any kind of converter out there for creating C#
JGcode out of C code?
JG>
JGRegards,
JG>
JGJon G
JG>
---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Sep 18 '06 #3
"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.comwrote in message
news:61**********************************@microsof t.com...
You may be able to compile your C code in a Visual Studio.NET C++ project
with the /CLR switch and it will be compiled into a .NET managed assembly.
This can be a viable route, but it depends on the code. VC++ can compile
C++ to managed code, but not C, so the first step would be to get the C
code to compile as C++. To make it accessible to C#, you'd then probably
have to wrap the C-style API into a class-based API, since C# has no concept
of a free function.

In the end, you'll still end up with a separate DLL since you can't mix C++
and C# in a single DLL. (Actually, I think you can, but it's not for the
faint of heart). In that case, the best option may be to simply compile the
C code into a DLL and use P/Invoke to call it from C# and skip the
conversion to managed C++.

Which is best depends a great deal on the nature of the C code in question.

-cd
Sep 18 '06 #4
Michael Nemtsev wrote:
I don't think that u find any kind of C to C# convertors.
Languages are too different as in syntas as in design. There is nothing
to convert.
There has been created language translators between almost
all languages, so of course it can be done.

The language itself should not be that bad - espcially
not if unsafe C# were allowed.

The C RTL would require some work though.

The only thing available seems to be
http://code2code.net/ though.

Something else is: what is the point ? The converted
code would not look like human written C# code, so
it would not be worth much.

Arne

Sep 19 '06 #5
Hello Arne_Vajhøj,

OP want to convert C to C#, it's not the same AS C++ to C#
C doesn't have classes, virtual function, exception handling and etc.
Convertion doesn't help u here, code need to be redisigned
AMichael Nemtsev wrote:
A>
>I don't think that u find any kind of C to C# convertors.
Languages are too different as in syntas as in design. There is
nothing
to convert.
AThere has been created language translators between almost all
Alanguages, so of course it can be done.
A>
AThe language itself should not be that bad - espcially not if unsafe
AC# were allowed.
A>
AThe C RTL would require some work though.
A>
AThe only thing available seems to be
Ahttp://code2code.net/ though.
ASomething else is: what is the point ? The converted code would not
Alook like human written C# code, so it would not be worth much.
A>
AArne
A>
---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Sep 19 '06 #6
Michael Nemtsev wrote:
>>I don't think that u find any kind of C to C# convertors.
Languages are too different as in syntas as in design. There is
nothing
to convert.
AThere has been created language translators between almost all
Alanguages, so of course it can be done.
AAThe language itself should not be that bad - espcially not if unsafe
AC# were allowed.
AAThe C RTL would require some work though.
AAThe only thing available seems to be
Ahttp://code2code.net/ though.
OP want to convert C to C#, it's not the same AS C++ to C#
C doesn't have classes, virtual function, exception handling and etc.
That argument is completely bogus.

What features C++ has that C does not have no impact what
so ever on whether a C++ to C# convert can be used
for converting from C to C#.

What matters is what features C has that C++ does
not have.

And that is rather limited.
Convertion doesn't help u here, code need to be redisigned
Not necessarily.

Arne
Sep 20 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: techy techno | last post by:
hii Experts..!! I need someone to tell me where I can get a Currency Converter like http://cconv.textor.com please can someone tell me where I can get it I need it for free + I dont need...
5
by: jorfei | last post by:
I have written a component with a property IPAdrress of type System.Net.IPAddress. To ease the configuration of the component at design time, I have written a type converter for the type...
3
by: Jon Rea | last post by:
is there a c# -> c++ code converter out there ? Hi people, I was just wondering if there is a C# to C++ converter out there. I have some working c# code and need to integrate it into a...
2
by: TheMadHatter | last post by:
does anybody know of a half decent converter????? I tried the "VBConversions VB.Net to C# Converter" with less than satisfactory results, and an unnecisary hole in the bank.
0
by: Max Power | last post by:
I'm having some trouble with an RTF converter called Logictran R2Net when two users access my site simultaneously. My application simply runs an SQL query (based on parameters typed by user) that...
4
by: John | last post by:
Hi Is there a way to convert whole c# projects (or solutions) to vb.net projects or solutions? Most converters I have come across only convert snippets. Thanks Regards
1
by: Nikola | last post by:
Hellooo! Can someone help me please. I tipe this code and it don't work!!! Whyyyyyy. <html> <head> <title>Text object value</title> <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"> <!--...
12
by: Tana | last post by:
Hi, My company wants to migrate all our apps from vb.net to c#. Can someone recommend a good migrate/convert tool? I am hoping that such a tool can do a 90-95% work for me, and I will do the...
10
by: esha | last post by:
I tried several online converters. In many case they do the job, but sometimes give some mess. I think that all converters I know are old, were created for VS 2003 and do not understand new stuff...
3
by: John Dalberg | last post by:
I have been trying a few commerical vb.net to c# converters. None of them converts inline vb.net asp.net code? Is there any converter that can convert inline code (code in aspx files)? I don't...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.