tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] libtcc not working properly on x86-64 targets


From: grischka
Subject: Re: [Tinycc-devel] libtcc not working properly on x86-64 targets
Date: Wed, 23 Dec 2009 15:29:11 +0100
User-agent: Thunderbird 2.0.0.23 (Windows/20090812)

Michael Kuklinski wrote:
Hmmm.... as a second addition to my last note (I am bad at mailing lists, sorry), if you allow the jump table in PE mode, by removing all #ifndef
relating to PE mode with the jump table and associated variables, it works
perfectly.

Glad you got it working.

Btw here is another idea.  You could actually just declare the
function(s) as dllexport and then add the program itself using
tcc_add_file.  It would then use it's own IAT (import address
table) as jump table.

--- grischka


#include <stdio.h>
#include "libtcc.h"

__declspec(dllexport) void print (const char *msg)
{
    printf("Say %s!\n", msg);
}

int main (int argc, char **argv)
{
    TCCState *s = tcc_new();
    tcc_set_output_type(s, TCC_OUTPUT_MEMORY);
    tcc_add_file(s, "this-prog.exe");

    if (tcc_compile_string(s, "main() { print(\"hello\"); }"))
        fprintf(stderr, "compile error\n");
    else
        tcc_run(s, 0, 0);

    tcc_delete(s);
    return 0;
}




reply via email to

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