unfortunately rediculous feature request: c++ interop

42 views
Skip to first unread message

Raoul Duke

unread,
Feb 3, 2015, 4:56:25 AM2/3/15
to ats-lang-users
http://ats-lang.sourceforge.net/DOCUMENT/INT2PROGINATS/HTML/c1994.html

Mentions C but I guess C++ is too weird to work with? :-( I wanna work
with OpenSceneGraph that is all in C++.

Ian Denhardt

unread,
Feb 3, 2015, 10:23:43 AM2/3/15
to Raoul Duke, ats-lang-users
Quoting Raoul Duke (2015-02-03 04:56:25)
> http://ats-lang.sourceforge.net/DOCUMENT/INT2PROGINATS/HTML/c1994.html
>
> Mentions C but I guess C++ is too weird to work with? :-( I wanna work
> with OpenSceneGraph that is all in C++.

It will involve a bit of boilerplate, but in a pinch you can write a
wrapper that let's the C++ be called from C. e.g:

// wrapper.h
#ifdef _cplusplus
extern "C" {
#endif

int fact2_in_cpp(int n);

#ifdef _cpplus
}
#endif

// wrapper.cpp
extern "C"
int fact2_in_cpp(int n) {
return cpp_library::fact2(n);
}

Then you can call the wrapper from ATS.

-Ian
signature.asc

Raoul Duke

unread,
Feb 3, 2015, 11:15:59 AM2/3/15
to Ian Denhardt, ats-lang-users
hi, Thanks for the suggestion re: externs. Yeah that is too much
effort. I'm going to try Felix and then Cling and then hope that Clasp
gets to a usable point soon. ;-) Or use a scheme.
(http://wmfarr.blogspot.com/2007/07/question-and-answer-sort-of-about.html)
I just want to make progress on the project rather than make my own
hacky tools or have to learn swig again. :-}

Brandon Barker

unread,
Feb 7, 2015, 10:09:59 AM2/7/15
to ats-lang-users, Ian Denhardt
Oh yeah, Felix ... I should really give it a try someday, but really, I just wish I could find a C or C++ oriented project to work on.

Maybe it is just my lack of perspective, but it really seems like SML style syntax is taking off these days. The funny thing is a lot of languages that do have such traits don't reference (S)ML as an influencing language on wikipedia, though Felix seems to be an exception.

It might be fun to show an interactive session log here:


--
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/CAJ7XQb6MqktNwMNAYzRAP_6xVFhPDYEGEDCjz%2BBrdA%2Bai-oEFQ%40mail.gmail.com.



--
Brandon Barker
brandon...@gmail.com
Reply all
Reply to author
Forward
0 new messages