Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
August 13, 2012 prevent multiple calls to rt_term | ||||
---|---|---|---|---|
| ||||
Hello. In Pyd, I am trying to get python extension libraries working, but this requires building shared libraries with D. LDC works adequately for this, if you don't mind not having module constructors or unittests; however, in the presence of multiple shared libraries coordinating rt_init and rt_term seems to be an issue. Currently, I have each shared lib calling rt_init in _init and rt_term in _fini. I would like to know if druntime supports a way to detect if it is running. For rt_term, I have been using rt.dmain2.isHalting, but that seems to have gone away in more recent druntime, and anyways doesn't seem to be working for me. I wonder if it would make more sense to call rt_init and rt_term in the druntime shared lib's _init and _fini? |
August 13, 2012 Re: prevent multiple calls to rt_term | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ellery Newcomer | Sounds like what's needed is a call counter, so if rt_init is called N times, rt_term must be called N times before the runtime really terminates.
On Aug 13, 2012, at 1:14 PM, Ellery Newcomer <ellery-newcomer@utulsa.edu> wrote:
> Hello.
>
> In Pyd, I am trying to get python extension libraries working, but this requires building shared libraries with D. LDC works adequately for this, if you don't mind not having module constructors or unittests; however, in the presence of multiple shared libraries coordinating rt_init and rt_term seems to be an issue.
>
> Currently, I have each shared lib calling rt_init in _init and rt_term in _fini. I would like to know if druntime supports a way to detect if it is running.
>
> For rt_term, I have been using rt.dmain2.isHalting, but that seems to have gone away in more recent druntime, and anyways doesn't seem to be working for me.
>
> I wonder if it would make more sense to call rt_init and rt_term in the druntime shared lib's _init and _fini?
|
August 13, 2012 Re: prevent multiple calls to rt_term | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean Kelly | On 08/13/2012 01:19 PM, Sean Kelly wrote:
> Sounds like what's needed is a call counter, so if rt_init is called N times, rt_term must be called N times before the runtime really terminates.
>
is it valid to call rt_init more than once?
|
August 13, 2012 Re: prevent multiple calls to rt_term | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ellery Newcomer | On Aug 13, 2012, at 2:07 PM, Ellery Newcomer <ellery-newcomer@utulsa.edu> wrote:
> On 08/13/2012 01:19 PM, Sean Kelly wrote:
>> Sounds like what's needed is a call counter, so if rt_init is called N times, rt_term must be called N times before the runtime really terminates.
>>
>
> is it valid to call rt_init more than once?
Not currently.
|
August 14, 2012 Re: prevent multiple calls to rt_term | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean Kelly | On 08/13/2012 03:37 PM, Sean Kelly wrote:
> On Aug 13, 2012, at 2:07 PM, Ellery Newcomer <ellery-newcomer@utulsa.edu> wrote:
>
>> On 08/13/2012 01:19 PM, Sean Kelly wrote:
>>> Sounds like what's needed is a call counter, so if rt_init is called N times, rt_term must be called N times before the runtime really terminates.
>>>
>>
>> is it valid to call rt_init more than once?
>
> Not currently.
>
I guess if it were made valid then module constructors would still be out?
IE if N shared libraries bring N sets of modules to the table and rt_init is called N times, then what's to prevent some module constructors from being run more than once?
|
Copyright © 1999-2021 by the D Language Foundation