Are there any C# to C converter tools? [closed] - c#

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I know C# is different from .NET Framework, C# is a programming language that standard by ECMA (ECMA-334) and ISO (ISO/IEC 23270).
I don't want a converter that converts ANY C# source code (including .NET Framework) to C, but I want a tool that converts an ECMA standard C# source code to ANSI C source code.
Something like java2c but for ECMA C#.

There is not exactly such thing, but the Vala programming language is able to take a source code very similar to C#, and generate C codem or compile it directly.
http://live.gnome.org/Vala
Of course, the only problem are the libraries: C# has a lot of API's that you'll have to provide, or modify your source code to adapt to the Vala standard library.
If you wanted to translate this code to C because you need it compiled, there are other possibilities.
For example, ngen in the microsoft world:
http://msdn.microsoft.com/en-us/library/6t9t5wcf(v=vs.80).aspx
In the mono project, you can create a single exe file with the interpreter and the libraries. Look for mkbundle:
http://www.mono-project.com/Mono:Runtime
Mono is able to compile "ahead of time", i.e., generate the native code even before the program is going to be executed, so it will run faster.
http://www.mono-project.com/Mono:Runtime#Ahead-of-time_compilation

Depends on what you mean. If you mean "Is it possible to convert C# to readable and maintainable C-code?", then sorry, the answer is no — C# features don't directly map to C.

Related

About C, C# and Unity compiling time [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
If I write a library for chess ai in C or C++ and I used in Unity with C# then is this library compiling fast like in C or slow like in C#.
For example; There is a code compiling in C 7secs and C# 1min. So, what will I see in Unity?
(F. Sorry for my bad language.)
Firstly, I don't know about those times, but let's assume you're right. You don't generally write C or C++ code that Unity will compile. You would compile your code to a DLL and include that DLL in your Unity project. As such, there would be no compile times for that specific DLL. It's not a bad practice if you've got a library that you don't need to compile often.
Another method to reduce compile times is to use Assembly definitions. This does a very similar thing to compiling your library in to DLLs, but is done "within the Editor". The basic premise is that once a project is compiled, it doesn't need to be compiled again unless there were changes made to it.
The Unity Docs here go into full detail.

Is it possible to use a c# dll in Qt? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I am writing a program that utilises a c# sdk. The functionality of this program will be used in a larger program written in c++ using QtCreator. I would like to create a c# dll to interact with the sdk and then consume this in the c++ program. Has anyone done this before and can point me in the right direction.
Many thanks.
You can, I do this regularly at work. You can consume C# from C++ using COM and Interop. Worth noting now that this is all windows only.
If you've not used COM from C++ before you are in for a nasty surprise. It's fairly unpleasant.
This is a very big topic, so I can't really cover it in a post, but if you want to learn more, I'd look here for starting on the C++ side:
COM(C++) programming tutorials?
I'd recommend using ATL to make your COM life a lot easier.
EDIT: Actually I didn't know this, but Qt has COM support, so you'd be much better off using that - Have a look at https://doc.qt.io/qt-5.10/activeqt-index.html
Google around for the C# side, but it's mostly about using the ComVisible and Guid attributes on your classes to make them COM ready and then registering them using regasm.exe (Part of the .NET Framework).

Implementing Lua for C# [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I've built a robust system that has many core functions that might actually get mess to use if I keep on expanding the code - therefore I decided to implement a scripting language and ability for program to read scripts from external files.
My first idea was to use C# by default, but then I've remembered how easy and readable Lua was, so I went with that - sadly, I can't find a simple yet effective library that would allow me to incorporate lua into my software.
tl;dr — is there a simple library one could use to implement lua and thus make usage of software built-in functions way easier? What are your thoughts and opinions on that?
First, there's MoonSharp.
I did experiments with it a while ago. Ultimately, I found it unsuitable for my needs, but it was straightforward to make use of.
Edit: dug up my GitHub repo where I tried this out.

Can I parse C functions with a regular expression in C#? [duplicate]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
For my diploma thesis I need to implement certain static C code analysis and I am desperately looking for a framework/library that would allow me to parse C source code, split it up into single functions, for every function determine what variables are changed in the function body and derive certain annotations for the code automatically.
Is there any good framework written in C# or generally as .Net class for this purpose?
What about googling for "C Parser written in C#"?
I got this as first link: http://code.google.com/p/cpp-ripper/
Also, I think the C grammar can be found in quite a lot of places, so you might just want to open up your .NET variant of lex/yacc and go from there?
You might like to check ANTLR. It comes with versions of several versions, included C and C#. There are some free grammars on ANTLR web site, including C.
I had a similiar problem and having done a research about YACC tools for C# I have chosen Gold Parsing System with Semantic Engine. My project was parsing SQL queries and generating logical query plans (from T-SQL grammar subset).
I really recommend it. Those 2 libraries make parsing stuff painless and allow to map grammar to the object model in your code. It feels very intuitive and made my project successful :) However, it may lack some advanced ANTLR features, so recognize your needs carefully.
Gold Project http://www.devincook.com/goldparser/
Semantic Engine Lib http://code.google.com/p/bsn-goldparser
If you're ok with using GPL'd code, you might want to take a look at the GCC source code. If you need to do it within .Net, you can always use p/invoke to call code from the GCC libraries.

Is there a valid alternative to ANTLR written in C#? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
ANTLR is a great piece of software, but, in my opinion, is a little bit uncomfortable for a C# programmer (the C# porting is out of date, the parser antlr-3.1.3.jar required java, etc)
I'm looking for a "more C# native" language tool in order to parse a simple json-like grammar, any suggestion?
I've used the GOLD Parser Generator, a freeware tool that you can use to specify BNF grammars, and then generate a parser in almost any target language including C#. You can also modify the way the parser generator generates C# code by altering a text template.
http://www.devincook.com/goldparser/
peg-sharp (C# packrat parser) is a simple but valid alternative.

Categories

Resources