[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] Using TCC to generate API wrappers
From: |
grischka |
Subject: |
Re: [Tinycc-devel] Using TCC to generate API wrappers |
Date: |
Sat, 24 Apr 2021 20:08:26 +0200 |
User-agent: |
Thunderbird 2.0.0.23 (Windows/20090812) |
Kevin Ingwersen via Tinycc-devel wrote:
Hello there!
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
As is, libtcc does not have support for that. You would need to
add some lines here or there. To start with, see tccgen.c:decl0():
#if 0
{
char buf[500];
type_to_str(buf, sizeof(buf), &type, get_tok_str(v, NULL));
printf("type = '%s'\n", buf);
}
#endif
I did use similar hacks to generate the list of function prototypes in
tcc.h initially. (long ago)
--- grischka
Thank you in advance!
Kind regards,
Kevin Ingwersen