|
From: | David Mertens |
Subject: | Re: [Tinycc-devel] libtcc using existing structs |
Date: | Sun, 27 Nov 2016 07:09:07 -0500 |
Hello folks,
I am successfully using libtcc to compile & link single C functions
on-the-fly. Everything works great for those small C functions which don't
do anything other than calling other functions which are already part of the
program that uses libtcc. I simply use tcc_add_symbol() to make those
functions become available to the compiled function.
However, now I am facing issues when I try to compile C code that creates an
instance of a struct. For example, I try to compile a C program that creates
an instance of a struct named foo:
struct foo f;
the struct "foo" is part of the already compiled program (the program that
uses libtcc to compile that smaller C program). The problem is that
compiling using tcc_compile_string() fails with the error message: "error:
unknown type size" at exactly that line. I understand that the compiler has
to know the declaration of the struct foo in order to work with it, however,
I fail to understand how I give TCC access to that struct declaration? I
tried using supplying the header file that contains the declaration of the
struct foo to TCC using tcc_add_file() but that didn't change anything at
all.
I'm a bit lost at this point and I'd be thankful for any kind of help.
Please excuse if I am using wrong terminology somewhere.
Best regards,
~ Joel
_______________________________________________
Tinycc-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/tinycc-devel
[Prev in Thread] | Current Thread | [Next in Thread] |