[Top][All Lists]

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

Re: [Tinycc-devel] S-Lang tinycc module.

From: Agathoklis D.E Chatzimanikas
Subject: Re: [Tinycc-devel] S-Lang tinycc module.
Date: Sat, 24 Mar 2018 01:14:58 +0200
User-agent: Mutt/1.9.0 (2017-09-02)


On Fri, Mar 23, at 08:58 grischka wrote:
> Agathoklis D.E Chatzimanikas wrote:
> > Hi,
> > 
> > I created a tinycc binding for the S-Lang programming language,
> > 
> > https://github.com/agathoklisx/slang-devel/tree/master/slang-modules/tcc
> > 
> > and while I was trying to create an executable, I had to use:
> > 
> >   tcc_set_options (tcc_handler, "-xn");
> > 
> > which sets tcc_handler->filetype to AFF_TYPE_NONE,
> > otherwise (the path) elf_output_file() -> tcc_add_runtime()
> > tries to compile /usr/local/lib/tcc/libtcc1.a when it calls
> > 
> >   tcc_add_support(s1, TCC_LIBTCC1);
> > 
> > I was wondering if there is a better librar"iezed" way.
> I guess that is a bug in tcc.

Yes, it's a bug.
On Fri, Mar 23, at 08:58 grischka wrote:
> I guess that is a bug in tcc.

But it's not a bug in the heart of gcc, which all of you should be
proud. It's a bug in the abstraction level.

Actually from a usage point view is not even serious, because your hack
with the tcc_set_options (), works flawselly as it has been proved
with the code above which i'm repeating:

   tcc_set_options (tcc_handler, "-xn");

But it might be a security (kinda) bug.

Now, as everybody (i guess) stack for a second when i saw this crystal clear
declaration on the comments (probably by Fabrice):

/* XXX: get rid of this ASAP */
ST_DATA struct TCCState *tcc_state;

Let's get it straight. There are two unrelated items here. The actual
(compiling stuff) implementation - in which I assume you are all here around,
and the: let's say, one kind of communication with the outside world :-).

So strictly speaking: its not your buissness.

> tcc_add_file() probably should preserve (save/restore) the original
> value of s->filetype.
> Also, tcc_add_runtime() probably should reset s->filetype to
> AFF_TYPE_NONE at entry.
> I admit that the filetype stuff isn't really clean but maybe with
> these adjustments it could work.  If you can fix it on the mob branch,
> welcome.

I will happily have a look at the next days, when I get some rest,
though as I've been already said I'm completelly novice in C (i don't
even know how to use the string functions properly!!!, I just use C (for
now at least) as a glue to expose C in S-Lang, following established slang
conventions). And I will do it, it would be nice to have my name to the
same table with legends (no matter the vanity :-)).

But, wouldn't be wiser to use some getters/setters to the tcc state (or
to expand the current interface with a couple more functions) and
be done with that, and then let the user to get the responsibility without
doubts at all?

I believe the distance from (the border of the communication) to (the
heart of tcc) can be narrowed a bit.

The code shouldn't be that hard, with an object oriented way.
Oh!!! I wish I could know more C so that I could write this code,
because if I do, you will probably give me write rights and this would
be beyond the dreams of an uneducated un-succesfull shepherd (but almost to
all the things he did in his life). Together with Fabrice Bellard!!! Of
who I don't know what kind of drugs he took at the nights when he wrote that
code but should be good.

So anyone takers from the outside world?

> Thanks,
> -- grischka

Best Regards,

reply via email to

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