grishka, thank you so much for pointing me in the right direction.

I was able to solve the problem (more or less) with this hint, though
this means to patch tclDecls.h and tclIntDecls.h, two headers I took in
from the tcl Source, so a bit problematic to maintain.

Furthermore, the __attribute__((dllimport)) is not needed, when
compiling against libtclstubsXX.a, and was not needed in 0.9.26,
behavior seems a bit inconsistent to me. Anyway, it's working for the
moment...

Is this changed in later dev-versions?

Michael


IIRC tcc from 0.9.27 on tries to help with a more explicit error message
made just for that case:

     tcc: error: undefined symbol 'xxxx', missing __declspec(dllimport)?

See also the libtcc_test.c example:

     /* this strinc is referenced by the generated code */
     const char hello[] = "Hello World!";

     char my_program[] =
     "..."
     "#ifdef _WIN32\n" /* dynamically linked data needs 'dllimport' */
     " __attribute__((dllimport))\n"
     "#endif\n"
     "extern const char hello[];\n"

     [...]
     tcc_add_symbol(s, "hello", hello);

FYI, the change was necessary with the introduction of 64-bit targets
to the effect that data objects that are resolved via tcc_add_symbol()
are now accessed by the same mechanism as those that come from dlls.

*This mechanism needs special code to be generated already at compile
time which is what happens when tcc sees __declspec(dllimport) (and
does not otherwise).*

-- grischka

_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to