c exec embeded in webpage - c

Does anyone know for a tool that allows a c executable to be run in the browser? I'm looking for a javascript, java, or flash solution because I don't have privileges to run c executables on the server.
The executables are basic input and output programs.

Looking at your comments, I hear you mention students and running simple programs. As a suggestion, you might want to look into CodePad. This will let you interpret simple C programs. Note that everything needs to be in one place, so you'll have to combine C and header files.
Here is a sample:
http://codepad.org/qQS31BwM
EDIT
Here's another one I found:
http://ideone.com/
When you run the program, at the bottom there is a link for input. You can use it to run the program with given input as entered.

You could use this as a basis for solving the problem:
http://bellard.org/jslinux/

Emscripten is an LLVM-to-JavaScript compiler. It takes LLVM bitcode (which can be generated from C/C++, using llvm-gcc or clang, or any other language that can be converted into LLVM) and compiles that into JavaScript, which can be run on the web (or anywhere else JavaScript can run).
Using Emscripten, you can
Compile C and C++ code into JavaScript and run that on the web
Run code in languages like Python as well, by compiling CPython from C to JavaScript and interpreting code in that on the web

Related

Create a final product through CodeBlocks with C Language

I am a newbie programmer (more specifically a student) which use CodeBlocks to many exercises (as much as I can). At the moment I am following this steps to create my own programs (File->New->Project->Console Application). This modality has served to learn C language, but I want create a software which any user could use (for now at Windows). Is it possible create some portable through various computers? I was exploring the another option I have on IDE but I don't understand so much, therefore I am very lost.
I googled about different projects which I can do with language C, but...sincerely, I got even more confused. Therefore, what's the next step, to make a more robust program in C?
Thanks
Make a HelloWorld program.
Run it in codeblocks.
Now go to the folder containing that file. You will find three files there.
HelloWorld.c
HelloWorld.o
HelloWorld
The last file HelloWorld is the executable. You can share it to other windows OS to run it.
EDIT:
C is a portable language so its viable. Do look into makefile as you intend to create a program that uses GUI, network etc. (RECOMMENDED)
Or you might want to create platform specific ones. For example, creating a debian package from your executable

how can I view the c code generated from my pypy program

Many language environments allow one to "disassemble" a provided function. Since Pypy compiles to C-code (if I understand things correctly). then it seems natural to be able to see a C-code dump from an expression, or a whole python file.
Can I do this? how?
PyPy does not compile python bytecode to C code. The tracing JIT replaces a frequently used piece of code with generated machine code (assembly). You can turn on logging to save the JIT traces to a file and view them with vmprof or jitviewer.

Minimal working example of mixed Julia and C project on Windows

I'm looking for a simple, minimal working example for a Julia project that includes some C code as part of the project. I need the project to compile the C code into a *.dll and then have some Julia code that can successfully call a function from that *.dll on Windows.
I'm having a lot of trouble getting this to work on Windows, and it would be really helpful to just start from some example that I know actually works, and troubleshoot from there why my larger project isn't working.
My use case is calling the portaudio library for low-latency presentation of sounds, using a lock-less multi-threading model. This isn't really possible to write in julia at this point, that I know of: I really need a system level language like C. But I'd like the rest of the project to be in Julia.
This blog post contains pretty much a minimal working example. It compiles a small linker code to GSL and then writes about 10 lines of Julia to use it. It even in that space shows how to pass a Julia-defined function to C.
This link is not a perfect example, but it's very very close. I haven't run this code, but the poster claims that it compiles and runs successfully on Windows.

Run C programs from sublime 2.02

I want to compile and run C/C++ programs with sublimetext 2 itself.I dont want to use terminal to do so. What do I need to do for this??I am compeletely new to this so a lot of answers to similar questions did not help me as most of them were for windows.
sublime text 2 build system for C programming language should show you how to setup your build environment. Note: you need gcc etc. installed
Edit: you should although run your programm in a Terminal because SublimeText2 is an Editor and can not recieve user input for your programm. so you better just build it with ST2 and run it in Terminal or you just forget about ST2 and make your own Bash script that manages compiling and runs the programm.
I would use sublime text as an editor (which is what IDEs are). Then you'll need to have a Makefile for your program. And build it by typing make in a terminal (or by configuring your editor to run that command). BTW, you can type m a k e enter once in your day (and later use up in the same terminal, to reapeat the latest command).
Learning how to write simple Makefile-s is a reusable skill (see here for "why?"). See this and that and many other examples. Don't attach yourself to one particular editor (even if you may like one more than others; my preference goes to emacs).
You'll learn a big lot by studying (and improving) the source code of some free software. Look at sourceforge, github, etc.. to find some free software interesting to you, then download its source code, build it, and study it.
The tips and advices I gave here are still valid today, with a recent Ubuntu (e.g. 14.x)
BTW, your question looks like you might be confused; Sublime Text is an editor (perhaps glorified as an IDE). It does not compile anything. The C or C++ compiler on Ubuntu is GCC (using gcc command for compiling C code, and g++ command for compiling C++ code) or perhaps Clang/LLVM (using clang command for C code, and clang++ command for C++ code). That compiler is often started by make, and IDEs on Linux are often running make -or directly the compiler- command for you. You'll better be able to run these commands yourself.

C code preprocessing in Perl

I work on the C code parser in Perl.
At the moment I need to pre-process the code.
Implementation of the pre-processing seems to be a lot of work, so I am looking for a script or library that will allow to pre-process the file.
I found the following possibilities:
Text::CPP
Filter::CPP
Both of these require cpp which I don't have on my Windows machine. Are there any other options?
I'm not sure I understand your needs, but you are right that implementing this yourself is probably a poor choice. I was recently looking for alternative C preprocessors as well.
The Text::CPP module should only require a compiler to compile itself. If you can find a precompiled version, it should work for you.
The JCPP Java C Preprocessor by the same author could probably be made to work. You'd likely have to process externally and then load the result.
Filepp is an older Perl program that claims CPP compatability. There is a precompiled Windows binary to download.
There is a brand new Lua C-Preprocessor LCPP that might be something you could work with. Probably best as a standalone, but you might be able to use Inline::Lua.
SWIG comes with its own preprocessor implementation. I presume this would be available for Windows.
What else? The Boost Wave Preprocessor might work well and is available for Windows.
The MSVC Compiler can preprocess to a file.
Still, the easiest and best long term solution may be to just install CPP. It comes as part of GCC, which you can get from Cygwin or MinGW.

Resources