shared lib
Ellery Newcomer
ellery-newcomer at utulsa.edu
Tue Nov 15 16:27:31 PST 2011
On 11/15/2011 01:19 AM, Jacob Carlborg wrote:
> On 2011-11-14 19:05, Ellery Newcomer wrote:
>
> core.runtime.Runtime.initialize
cool
>
> Not sure if that will initialize everything properly. Have a look in
> rt.dmain2.main and make sure you do that same initialize the runtime.
yep, found that file yesterday a little after I posted
>
> It would be better if rt.dmain2.main would call rt.dmain2.rt_init
> instead of do all the initialize directly in main.
>
I just call rt_init and rt_term. The one thing I'm wondering about is
what happens when I need to load multiple d shared libs (the shallow
answer is rt_term crashes, but rt_init doesn't). I assume it would
create two instances of the d runtime, which is just lovely from a
memory leakage perspective.
So my bare bones looks like this just now:
extern(C) shared bool _D2rt6dmain212_d_isHaltingOb;
alias _D2rt6dmain212_d_isHaltingOb _d_isHalting;
extern(C) {
void rt_init();
void rt_term();
void _init() {
rt_init();
}
void _fini() {
if(!_d_isHalting){
rt_term();
}
}
} /* extern(C) */
I suppose the isHalting test should go in a critical section, but
otherwise I have working pyd modules!
Now if only I could remember why I wanted to use pyd in the first place..
More information about the Digitalmars-d-learn
mailing list