Clueless re: gc

uh, how do i enable GC? seems hard to find the answer.

http://blog.gmane.org/gmane.comp.lang.ats.user

That is confusing to me. It almost sounds like I have to re-build my
ATS installation to get GC? I was assuming/hoping that it would be a
flag passed to patscc that would let me do it
per-file/project/something?

There are plenty examples like this. For instance, I once wrote a “worm”
game that runs with GC support; the GUI for the game is based on GTK.
I do not really feel that reading such examples would be very helpful. Just
imagine that you will be using two sets of malloc/free in your code. And
that
is all.On Tuesday, February 3, 2015 at 1:40:49 PM UTC-5, Raoul Duke wrote:

Do people have / I must go re-read in the docs any examples of doing:
ATS + GC calling into C libraries that themselves were not linked with
GC? I assume it is the same thing as if I were just doing that from
regular C/++? But then ATS has the advantage that if one can learn how
the linear etc. typing works then one can track that other non-GC
memory?

Ok looking at the Makefile, I guess I really do have to rebuild my
ATS installation. I can only have one option for GC and it is global,
at a time?!

No, you do not need to rebuild ATS. Whether your code runs with or without
GC is extern to ATS. Think of GC as just another way to implement
malloc/free.

How does all this actually play out? If I’m writing ATS to work with
C++ libraries, can I use GC still in any easy way?

thanks :}

Sure. Your code uses malloc/free with GC support and C++ library code uses
its own malloc/free.

uh, how do i enable GC? seems hard to find the answer.

http://blog.gmane.org/gmane.comp.lang.ats.user

That is confusing to me. It almost sounds like I have to re-build my
ATS installation to get GC? I was assuming/hoping that it would be a
flag passed to patscc that would let me do it
per-file/project/something?

I believe you have to pass “-D_ATS_GCATS” to the command line (that’s
“-D_ATS_GC” to disable it). I don’t think you have to build ATS with GC to
use GC in applications translated to C with ATS.

hi, Thanks for all the notes. I will go practice. :slight_smile:

Do people have / I must go re-read in the docs any examples of doing:
ATS + GC calling into C libraries that themselves were not linked with
GC? I assume it is the same thing as if I were just doing that from
regular C/++? But then ATS has the advantage that if one can learn how
the linear etc. typing works then one can track that other non-GC
memory?

Enable GC

Say you have foo.dats and you want to run foo with GC support:

patscc -DATS_MEMALLOC_GCBDW -o foo foo.dats

You do not need to rebuild/reinstall ATS

You only need to rebuild ATS if you want to run patsopt with GC support.On Tuesday, February 3, 2015 at 4:47:53 AM UTC-5, Raoul Duke wrote:

uh, how do i enable GC? seems hard to find the answer.

http://blog.gmane.org/gmane.comp.lang.ats.user

That is confusing to me. It almost sounds like I have to re-build my
ATS installation to get GC? I was assuming/hoping that it would be a
flag passed to patscc that would let me do it
per-file/project/something?

Don’t thanks me for one error: to disable, it’s “-D_ATS_NGC” instead of
“-D_ATS_GC” as I erroneously said.Le mardi 3 février 2015 17:10:55 UTC+1, Raoul Duke a écrit :

thanks!

Ok looking at the Makefile, I guess I really do have to rebuild my
ATS installation. I can only have one option for GC and it is global,
at a time?!

How does all this actually play out? If I’m writing ATS to work with
C++ libraries, can I use GC still in any easy way?

thanks :}

thanks!

-D_ATS_GCATS is only for ATS1; it is not available for code
written in ATS2.

My understanding is that Raoul wants to run his own code (written in ATS2)
with GC support.On Tuesday, February 3, 2015 at 5:08:02 AM UTC-5, Yannick Duchêne wrote:

Le mardi 3 février 2015 10:47:53 UTC+1, Raoul Duke a écrit :

uh, how do i enable GC? seems hard to find the answer.

http://blog.gmane.org/gmane.comp.lang.ats.user

That is confusing to me. It almost sounds like I have to re-build my
ATS installation to get GC? I was assuming/hoping that it would be a
flag passed to patscc that would let me do it
per-file/project/something?

I believe you have to pass “-D_ATS_GCATS” to the command line (that’s
“-D_ATS_GC” to disable it). I don’t think you have to build ATS with GC to
use GC in applications translated to C with ATS.