Generating C headers from SATS files?

42 views
Skip to first unread message

Shea Levy

unread,
Sep 12, 2014, 3:37:51 PM9/12/14
to ats-lan...@googlegroups.com
Hi all,

If I wanted to write a library in ats that can be called from C, is
there a way to generate headers from my sats files? Ideally these would
be self-contained, that is not depend on any ATS runtime headers.

~Shea

Brandon Barker

unread,
Sep 12, 2014, 3:47:04 PM9/12/14
to ats-lang-users
I want to say, maybe using atsdoc , but sadly I haven't used it yet.


~Shea

--
You received this message because you are subscribed to the Google Groups "ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/20140912193748.GC4120%40nixos.hsd1.nh.comcast.net.



--
Brandon Barker
brandon...@gmail.com

gmhwxi

unread,
Sep 12, 2014, 8:05:02 PM9/12/14
to ats-lan...@googlegroups.com
Not sure about what you want here.

You can write a library in ATS and then distribute the C code
generated from your ATS source. The ATS runtime headers can be
part of your distributed code as they have been given the BSD style
license. Are you saying that you want to distribute .a or .so files?

Shea Levy

unread,
Sep 12, 2014, 9:06:18 PM9/12/14
to ats-lan...@googlegroups.com
Ideally I would distribute .so files, .sats files for ats programs, and
.h files for C programs. I think I've got a good enough sense of how ats
compilation works to generate the shared library and then link to it
later, and of course I write the .sats files, so now I'm just figuring
out the .h files. patsopt with the --static flag doesn't seem to export
a function definition when I try something like

> fn foo {l: addr} (int @ l | ptr l): int = "ext#"

~Shea
> --
> You received this message because you are subscribed to the Google Groups "ats-lang-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-user...@googlegroups.com.
> To post to this group, send email to ats-lan...@googlegroups.com.
> Visit this group at http://groups.google.com/group/ats-lang-users.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/fb8b923f-be04-4c2f-b7f4-0a6e342c9b5f%40googlegroups.com.

Hongwei Xi

unread,
Sep 13, 2014, 8:28:04 PM9/13/14
to ats-lan...@googlegroups.com
The generated C types for ATS functions are usually very un-informative.
For instance, void* is used for every boxed value. So you may want to find another
way to get the C types for the functions in your library.


Reply all
Reply to author
Forward
0 new messages