tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] libtcc (dll) doesn't work for memory output...


From: Gabriel Corneanu
Subject: [Tinycc-devel] libtcc (dll) doesn't work for memory output...
Date: Tue, 10 Sep 2013 13:10:08 +0200

Hello,

I am using libtcc to generate some dynamic code; simple example:

int foo(int n1, int n2){ return n1+n2; }

It used to work using tcc_set_options(FState, "-nostdlib"), tcc_compile_string, tcc_get_symbol("foo") then call it...

The current state doesn't work anymore like before...

1. "nostdlib" is not properly used somewhere in pe_output_file / pe_add_runtime; it always searches for some startup code (start_symbol).
the error is 'tcc: error: _runmain not defined', and then it calls tcc_error as explained at #2 (exit!)
2. some compile errors (see #1) reach "tcc_error" where error_set_jmp_enabled is 0, therefore terminating my program!

I modified pe_output_file by using
if(!s1->nostdlib) pe_add_runtime(s1, &pe);
This seems to work for me, but I'm not sure if it's the best solution.
E.g if I still need the stdlib for "printf", I get back to the same problem

3. Why do I NEED a startup code for memory output? I extract my symbols and call the functions directly.
The workaround is to have dummy "runmain", and "main" ...

Regards,
Gabriel


reply via email to

[Prev in Thread] Current Thread [Next in Thread]