Re: [racket] C++ Extensions and Classes

2014-02-06 Thread Cody Eilar
Jon, You're right, that's the way to do it. I realized that a bit earlier today and wrote the code for it. Sorry, dumb mistake. I was thinking that I should do everything in the extension, but instead I create two separate extensions and just pass a pointer to the objects in scheme. So in shor

Re: [racket] C++ Extensions and Classes

2014-02-06 Thread Jon Zeppieri
Okay. If you want one module to include code from the other, you can simply include it. If you're worried about multiple definitions of scheme_initialize, scheme_reload, and scheme_module_name, why wouldn't you just pull all of the rest of the code -- the common code -- into a separate file and hav

Re: [racket] C++ Extensions and Classes

2014-02-06 Thread Cody Eilar
Hmmm, I haven't had to wrap anything using extern C because all the function prototypes are in C already I believe (the three I mentioned above). The main idea here is that I want to reuse my extensions in the same way that my classes are constructed. I want to write extensions separately for each

Re: [racket] C++ Extensions and Classes

2014-02-06 Thread Jon Zeppieri
I'm not entirely sure that I follow, but if you're writing these extension functions in C++, I believe you'll need to wrap their prototypes in an extern(C) { ... } block so that they'll be given un-mangled names for the linker to use. On Thu, Feb 6, 2014 at 4:56 PM, Cody Eilar wrote: > I understa

Re: [racket] C++ Extensions and Classes

2014-02-06 Thread Cody Eilar
I understand that, the issue is that I have to provide three functions that are not static so that I can make my c++ code known to scheme. Those functions are: scheme_reload(Scheme_Env *env) scheme_initialize(Scheme_Env *env) scheme_module_name() Each one of these functions are known to the linke

Re: [racket] C++ Extensions and Classes

2014-02-06 Thread David T. Pierson
On Wed, Feb 05, 2014 at 02:16:54PM -1000, Cody Eilar wrote: > > But what I really want is: > > > > Foo_ext.h: > > > > func1_racket_ext() { /*... do racket stuff and run func1() */} > > > > /* Scheme initializes etc... */ > > > > > > Bar_ext.cpp: > > #include "Foo_ext.h" > > > > func2_racket_ext() {

[racket] C++ Extensions and Classes

2014-02-05 Thread Cody Eilar
> > > > I asked this same question on the dev side but didn't get any > response, so I thought this list might be more appropriate. So I have been > writing some racket extensions for some C++ classes using the tutorial ( > http://docs.racket-lang.org/inside/overview.html) on the racket site