I've started porting fastcomp (llvm/clang) to run in a browser to compile 
and execute c/c++ code. However I ran into an issue getting it to read some 
header files. I'm trying to use the createPreloadedFile API to load them 
from Module.preRun but that doesn't seem to be working.

Here's what I put in var Module:
      preRun: function() {
        console.log('prerun');
        FS.createPath("/", "system/include/libc/bits/", true, true);
        FS.createPreloadedFile('/system/include/libc/', 'stdio.h', 
'emscripten_datafiles/include/libc/stdiytdfhjyfo.h', true, true);
        FS.createPreloadedFile('/system/include/libc/', 'features.h', 
'emscripten_datafiles/include/libc/features.h', true, true);
        FS.createPreloadedFile('/system/include/libc/bits/', 'alltypes.h', 
'emscripten_datafiles/include/libc/bits/alltypes.h', true, true);

      },

The full file is in the attachment. Also, here's a link to all of the files 
for the test page *(It's modified from the test page in clangor-master/js 
<https://github.com/kripken/clangor/tree/master/js>)*:
http://www.mediafire.com/download/dtifmmt9ktvqt2u/fastcomp_browsertest.zip


But when I run it the javascript console doesn't print the "prerun" string 
so I suspect it's not even running. Any ideas? 

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
Title: Clang in JS

Clang in JS

This is Clang running in JS, ported by emscripten.

input

#include int main() { printf("hello, world!\n"); return 0; }

console


        

output


        

Execute »

Limitations

C preprocessor is not hooked up.

If you want to also execute the code, use this LLVM IR runner or one of the many CPU emulators out there in JS.

Fork me on GitHub

Reply via email to