<div>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: </div>
<div> </div>
<div>scheme_reload(Scheme_Env *env)</div>
<div>scheme_initialize(Scheme_Env *env)</div>
<div>scheme_module_name()</div>
<div> </div>
<div>Each one of these functions are known to the linker. Inside the Foo_ext.cpp file, I have these three functions implemented. But in order to use Bar_ext.cpp I have to implement them as well, which means I have multiple declarations to the same function. So my Bar_ext.cpp file would Ideally look something like this: </div>
<div> </div>
<div>Bar_ext.cpp</div>
<div>scheme_reload(Scheme_Env *env)</div>
<div>{</div>
<div> /* Bar _ext reload stuff */ </div>
<div> Foo_ext.scheme_reload(env)</div>
<div>} </div>
<div> </div>
<div>Currently, the only way I see to solve this is to use a bunch of ifdefs, but I was curious if there was a more elegant solution. </div>
<div> </div>
<div>Thanks!<br><br></div>
<div class="gmail_quote">On Thu, Feb 6, 2014 at 2:48 AM, David T. Pierson <span dir="ltr"><<a href="mailto:dtp@mindstory.com" target="_blank">dtp@mindstory.com</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">
<div class="im">On Wed, Feb 05, 2014 at 02:16:54PM -1000, Cody Eilar wrote:<br>> > But what I really want is:<br>> ><br>> > Foo_ext.h:<br>> ><br>> > func1_racket_ext() { /*... do racket stuff and run func1() */}<br>
> ><br>> > /* Scheme initializes etc... */<br>> ><br>> ><br>> > Bar_ext.cpp:<br>> > #include "Foo_ext.h"<br>> ><br>> > func2_racket_ext() {/* ... do more racket stuff and run func2() /*}<br>
<br></div>Disclaimer: I know nothing about Racket extensions.<br><br>In C++, if you want to be able to call a function from multiple .cpp<br>files, you typically put the *declaration* in a header:<br><br> void func1_ext(void);<br>
<br>The definition would still go in a .cpp file:<br><br> void func1_ext(void)<br> {<br> /*...*/<br> }<br><br>You typically only put the definition in a header if you want to make an<br>inline function. It doesn't seem like you want an inline function here.<br>
<br>Does that help?<br><span class="HOEnZb"><font color="#888888"><br>David<br></font></span></blockquote></div><br>