Thread overview
GC
Mar 30, 2004
imr1984
Mar 30, 2004
Walter
Mar 31, 2004
imr1984
Apr 01, 2004
Walter
Apr 01, 2004
imr1984
Apr 01, 2004
Vathix
Apr 01, 2004
Hauke Duden
Apr 01, 2004
Vathix
March 30, 2004
i have written an exe and a dll in D. Is it possible to make them share the same garbage collector? The reason for this is that i want to share memory between the exe and the dll freely without the hassle of creating copies of the data etc. At the moment the garbage collector of the dll is overwriting the memory of the exe.

Also, when is that section "How Garbage Collection Works" on the site gonna be written?


March 30, 2004
You'll have to put the gc into the dll as 'exported', and then create an import library for the gc entry points to link the exe with.

"imr1984" <imr1984_member@pathlink.com> wrote in message news:c4bmh3$5qc$1@digitaldaemon.com...
> i have written an exe and a dll in D. Is it possible to make them share
the same
> garbage collector? The reason for this is that i want to share memory
between
> the exe and the dll freely without the hassle of creating copies of the
data
> etc. At the moment the garbage collector of the dll is overwriting the
memory of
> the exe.
>
> Also, when is that section "How Garbage Collection Works" on the site
gonna be
> written?
>
>


March 31, 2004
so do you mean i pass the _gc global variable to the dll, and then comment out
the gc_init() and gc_term() calls in the dll?

In article <c4ckhi$1neo$1@digitaldaemon.com>, Walter says...
>
>You'll have to put the gc into the dll as 'exported', and then create an import library for the gc entry points to link the exe with.
>
>"imr1984" <imr1984_member@pathlink.com> wrote in message news:c4bmh3$5qc$1@digitaldaemon.com...
>> i have written an exe and a dll in D. Is it possible to make them share
>the same
>> garbage collector? The reason for this is that i want to share memory
>between
>> the exe and the dll freely without the hassle of creating copies of the
>data
>> etc. At the moment the garbage collector of the dll is overwriting the
>memory of
>> the exe.
>>
>> Also, when is that section "How Garbage Collection Works" on the site
>gonna be
>> written?
>>
>>
>
>


April 01, 2004
Are you familiar with the mechanics of making a DLL in C? dllexport, dllimport, etc.?

"imr1984" <imr1984_member@pathlink.com> wrote in message news:c4eghk$1l6o$1@digitaldaemon.com...
> so do you mean i pass the _gc global variable to the dll, and then comment
out
> the gc_init() and gc_term() calls in the dll?
>
> In article <c4ckhi$1neo$1@digitaldaemon.com>, Walter says...
> >
> >You'll have to put the gc into the dll as 'exported', and then create an import library for the gc entry points to link the exe with.
> >
> >"imr1984" <imr1984_member@pathlink.com> wrote in message news:c4bmh3$5qc$1@digitaldaemon.com...
> >> i have written an exe and a dll in D. Is it possible to make them share
> >the same
> >> garbage collector? The reason for this is that i want to share memory
> >between
> >> the exe and the dll freely without the hassle of creating copies of the
> >data
> >> etc. At the moment the garbage collector of the dll is overwriting the
> >memory of
> >> the exe.
> >>
> >> Also, when is that section "How Garbage Collection Works" on the site
> >gonna be
> >> written?
> >>
> >>
> >
> >
>
>


April 01, 2004
well i dont want to resort to an import library because i want the dll to be like a plug-in for my exe, so i want to be able to swap around dlls and load them dynamically using LoadLibrary() etc. Is there no way to pass the exes gc variable safely to the dll? I tried it but it caused crashing

In article <c4frhb$nfv$1@digitaldaemon.com>, Walter says...
>
>Are you familiar with the mechanics of making a DLL in C? dllexport, dllimport, etc.?
>
>"imr1984" <imr1984_member@pathlink.com> wrote in message news:c4eghk$1l6o$1@digitaldaemon.com...
>> so do you mean i pass the _gc global variable to the dll, and then comment
>out
>> the gc_init() and gc_term() calls in the dll?
>>
>> In article <c4ckhi$1neo$1@digitaldaemon.com>, Walter says...
>> >
>> >You'll have to put the gc into the dll as 'exported', and then create an import library for the gc entry points to link the exe with.
>> >
>> >"imr1984" <imr1984_member@pathlink.com> wrote in message news:c4bmh3$5qc$1@digitaldaemon.com...
>> >> i have written an exe and a dll in D. Is it possible to make them share
>> >the same
>> >> garbage collector? The reason for this is that i want to share memory
>> >between
>> >> the exe and the dll freely without the hassle of creating copies of the
>> >data
>> >> etc. At the moment the garbage collector of the dll is overwriting the
>> >memory of
>> >> the exe.
>> >>
>> >> Also, when is that section "How Garbage Collection Works" on the site
>> >gonna be
>> >> written?
>> >>
>> >>
>> >
>> >
>>
>>
>
>


April 01, 2004
imr1984 wrote:
> well i dont want to resort to an import library because i want the dll to be
> like a plug-in for my exe, so i want to be able to swap around dlls and load
> them dynamically using LoadLibrary() etc. Is there no way to pass the exes gc
> variable safely to the dll? I tried it but it caused crashing

Have one special DLL that the EXE and plugins link with that contains the GC. I've wanted to do this before but I'm not exactly sure what all to export. Plus I think the DLL would need a special shared memory section so each time it's loaded it shares the same GC state.


-- 
Christopher E. Miller
April 01, 2004
Vathix wrote:
>> well i dont want to resort to an import library because i want the dll to be
>> like a plug-in for my exe, so i want to be able to swap around dlls and load
>> them dynamically using LoadLibrary() etc. Is there no way to pass the exes gc
>> variable safely to the dll? I tried it but it caused crashing
> 
> 
> Have one special DLL that the EXE and plugins link with that contains the GC. I've wanted to do this before but I'm not exactly sure what all to export. Plus I think the DLL would need a special shared memory section so each time it's loaded it shares the same GC state.

On Windows every DLL is loaded at most once per process (multiple LoadLibrary calls will just return a new handle to the same module) and memory allocated by any module of the process can be accessed by all the other modules. So no explicit memory sharing stuff should be required.

Hauke
April 01, 2004
Hauke Duden wrote:

> Vathix wrote:
> 
>>> well i dont want to resort to an import library because i want the dll to be
>>> like a plug-in for my exe, so i want to be able to swap around dlls and load
>>> them dynamically using LoadLibrary() etc. Is there no way to pass the exes gc
>>> variable safely to the dll? I tried it but it caused crashing
>>
>>
>>
>> Have one special DLL that the EXE and plugins link with that contains the GC. I've wanted to do this before but I'm not exactly sure what all to export. Plus I think the DLL would need a special shared memory section so each time it's loaded it shares the same GC state.
> 
> 
> On Windows every DLL is loaded at most once per process (multiple LoadLibrary calls will just return a new handle to the same module) and memory allocated by any module of the process can be accessed by all the other modules. So no explicit memory sharing stuff should be required.
> 
> Hauke

Oh yea! you're right. I was thinking about it being loaded by multiple processes, which that isn't the case here.


-- 
Christopher E. Miller