[racket] C++ Extensions and Classes

From: David T. Pierson (dtp at mindstory.com)
Date: Thu Feb 6 07:48:01 EST 2014

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() {/* ... do more racket stuff and run func2() /*}

Disclaimer: I know nothing about Racket extensions.

In C++, if you want to be able to call a function from multiple .cpp
files, you typically put the *declaration* in a header:

  void func1_ext(void);

The definition would still go in a .cpp file:

  void func1_ext(void)
  {
    /*...*/
  }

You typically only put the definition in a header if you want to make an
inline function.  It doesn't seem like you want an inline function here.

Does that help?

David

Posted on the users mailing list.