Re: Questions about GC in a library.

Bruce Hoult <[email protected]>
Newsgroups gmane.comp.programming.garbage-collection.boehmgc
Message-ID <CAMU+Eky_-DwyvohDe0qJXZ2MMtZu6HmB26OMpO2-P4rMzMusOg@mail.gmail.com>
Surely if your objects are to be managed by the GC, the end users will only
ever see a pointer to your objects, and never the object itself?

Don't include gc.h in your public header and put only incomplete class
declarations there.


On Tue, Nov 12, 2013 at 10:08 AM, The Devils Jester <
[email protected]> wrote:

> That solves the GC_INIT problem if that is allowed, unfortunately, it does
> not solve the include issue as the applications still need access to the
> classes I have defined that inherit from the gc, and those objects should
> still be managed by the GC, I just do not want to force my end users to
> also deal with the GC.
>
>
> On Mon, Nov 11, 2013 at 3:02 PM, Bruce Hoult <[email protected]> wrote:
>
>> You can make an init() function for your library and have the user call
>> that at the start of main(). Then they don't need to include GC headers
>> themselves.
>>
>>
>>
>> On Tue, Nov 12, 2013 at 8:30 AM, The Devils Jester <
>> [email protected]> wrote:
>>
>>> I have my code (which uses the GC) encapsulated in a library for
>>> modularity purposes.
>>>
>>> If a user includes my headers, which include, by necessity the GC
>>> headers, then they indirectly include the GC in their program.  Is there a
>>> way to prevent this?  In my library (if it makes any difference) I only use
>>> the GC on classes that inherit from gc or containers that use the gc
>>> allocator.
>>>
>>> In addition, the documentation on GC says that one should call GC_INIT
>>> in the main thread of the program, it is my goal, however, to not expose
>>> the inner workings of the library (if it uses the GC or not) to the
>>> program.  Is it safe to call this from the library, as long as its called
>>> before anything else?
>>>
>>> --
>>> This message has been scanned for viruses and
>>> dangerous content by *MailScanner* <http://www.mailscanner.info/>, and
>>> is
>>> believed to be clean.
>>> _______________________________________________
>>> Gc mailing list
>>> Gc-V9/[email protected]
>>> http://www.hpl.hp.com/hosted/linux/mail-archives/gc/
>>>
>>
>>
>
> --
> This message has been scanned for viruses and
> dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
> believed to be clean.
>

_______________________________________________
Gc mailing list
Gc-V9/[email protected]
http://www.hpl.hp.com/hosted/linux/mail-archives/gc/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.