[Rd] Embedding R in C++
Zed A. Shaw
zedshaw@zedshaw.com
Fri Jan 31 09:22:03 2003
Hi Folks,
Alright, so I'm figuring out how to embed from the various docs and
other nuggets of hidden information, and I've managed to get a nice
little C++ framework going which is supposed to make working with R
embedded stuff much easier. The problem is, R likes to define things
that other libraries also like to define. For example, the libg++-v3
library has a macro called length, and so does R. This causes ALL
iostream uses to fail. R also defines PI, which is defined in another
toolkit. We also use a set of debugging macros named TRACE,
UNIMPLEMENTED, and so on, but we can work around those problems.
The work around to the iostream problem is to order the includes so
that C++ stuff comes before R stuff. This works in most cases, but
some don't (like with PI, TRACE, and UNIMPLEMENTED).
Has anyone else run into these kinds of problems mixing R with C++?
I'm curious how you worked around it. Thanks in advance.
-----
Zed A. Shaw
http://www.zedshaw.com/