tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] Question about in-memory compilation, target


From: Eric Raible
Subject: Re: [Tinycc-devel] Question about in-memory compilation, target
Date: Sat, 10 Feb 2024 15:19:16 -0800

I've just taken a closer look at libtcc.h.  Now, I realize that this is radical,
but for the sake of discussion... if we're willing to break compatibility it seems
to me that just one new API:

/* add option as on a comment line (multiple supported) */
LIBTCCAPI int tcc_argv_add(TCCState *s, const char *str);

could replace all of:

LIBTCCAPI int tcc_set_options(TCCState *s, const char *str);
LIBTCCAPI void tcc_set_lib_path(TCCState *s, const char *path);
LIBTCCAPI int tcc_add_include_path(TCCState *s, const char *pathname);
LIBTCCAPI int tcc_add_sysinclude_path(TCCState *s, const char *pathname);
LIBTCCAPI void tcc_define_symbol(TCCState *s, const char *sym, const char *value);
LIBTCCAPI void tcc_undefine_symbol(TCCState *s, const char *sym);
LIBTCCAPI int tcc_add_file(TCCState *s, const char *filename);

Also, now that tcc_relocate() has no options, tcc_get_symbol() could
just remember if it's been called and call tcc_relocate(s) on its
first invocation.

So this would also disappear:

/* do all relocations (needed before using tcc_get_symbol()) */
LIBTCCAPI int tcc_relocate(TCCState *s1);

Food for thought, perhaps.

- Eric



reply via email to

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