tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] __attribute__((constructor)) not getting called


From: Steffen Nurpmeso
Subject: Re: [Tinycc-devel] __attribute__((constructor)) not getting called
Date: Sun, 02 Oct 2022 02:27:19 +0200
User-agent: s-nail v14.9.24-306-g2c333c91d1

Liam Wilson wrote in
 <CAO5MFrp9kjjWAPy0PFOHeQmOZtMxNd3Fc9yECX=NbnfEr3pN3g@mail.gmail.com>:
 |On Sat, 1 Oct 2022 at 17:00, Steffen Nurpmeso <steffen@sdaoden.eu> wrote:
 |> Liam Wilson wrote in
 |>  <CAO5MFrouT56VLH68eoxJfUPi-60ByDA1bhFPnGrWziEdqQ1Nng@mail.gmail.com>:
 |>  ...
 |>|I've been attempting to build nodejs Node-API addons using the tiny c
 |>|compiler. When doing this I noticed that the addons were failing to
 |>|self register on load in nodejs as the constructors were failing to
 |>|run. gcc worked fine, but tcc failed. Node-API addons use
 |>|__attribute__((constructor)) in order to register themselves on load.
 |>
 |> Spoiler attack: i consider this a feature.
 |> I never used static constructors in C++, and i hated Stroustrup's
 |> "injection" idea.  (There was a short time when i used it, but it
 |> is sick.)  Anyhow on first-time-init-switches ... when i create
 |> a framework that uses dynamic modules, why can't i define
 |> a special symbol that is called when it is defined upon load?  Like
 |> __nodejs_init() or something?  We surely do not want to create too
 |> many specifics, it is just a loose thing, maybe.  Hm.
 |
 |Yep, I'm not a fan of static contructors either. I think explcit
 |initialisation is a better idea. Unfortunately the API uses
 |__attribute__((constructor)) so currently there is no work around. I
 |will raise on the nodejs issue tracker though as it would be nice if
 |it could optionally just call an explicit init function.

Mine was not a serious statement really.

 |More generally though, it seems that no attributes will work with tcc
 |when including common glibc headers.

Ciao.

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)



reply via email to

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