|
From: | Clive Tovero |
Subject: | Re: [Tinycc-devel] Using TCC to generate API wrappers |
Date: | Mon, 26 Apr 2021 21:46:33 -0400 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 |
It does seem like primary goals of Tinycc are simplicity and speed, and adding such a feature might impact those goals. However, the functionality Kevin originally asked for would be generally useful, without bringing the baggage of a fairly large dependency (like SWIG or clang). It's interesting to consider how layering Tiny C into distinct compile phases (with an API) and maybe adding a formalized AST would impact performance. (My guess is that a separate project would be better, but I think there is room between "Tiny C" and "Giant Crufty C".) Another idea specific to Kevin's situation would be, if someone was so inclined, to make a stand-alone tool using the Tiny C code as a basis, with unneeded code stripped out. I did a similar thing with Femtolisp, when I needed an S-expression reader/printer but not the other stuff. Tiny C is a small enough project to wrap your head around and do something like this--and still have code which is maintainable. Arnold wrote:
TCC is the wrong tool for the job. Look into SWIG, which already does this for a number of langauges.
Kevin Ingwersen via Tinycc-devel <tinycc-devel@nongnu.org> wrote:
Quick and short question: Can I use libtcc to extract symbol information (types, functions, structs, enums, unions) from a C header so that I can then use it to generate a wrapper? My goal is to automate the process of C interop generation for the V language, which uses TCC as one of the mainly supported compilers - so the source is already accessible even from a standard V installation, hence my thought of possibly taking advantage of that to generate wrappers
[Prev in Thread] | Current Thread | [Next in Thread] |