<div dir="ltr"><div><div><div><div><div><div>Hi again,<br><br></div>I solved the problem. In fact it is not related to chuck or chugin but more related to C and C++ (and my poor knowledge of this last one).<br><br></div>When including C function in a C++ project .h files must be modified like this to declare prototypes:<br>
<br>#ifdef __cplusplus<br>extern "C" {<br>#endif<br><br></div>// Your C prototypes<br><br>#ifdef __cplusplus<br>}<br>#endif<br><br><br></div>I understand this might be obvious for many of you, so I apologize for the noise on the mailing list.<br>
<br></div>Have fun,<br><br></div><div>Ju<br></div><div><div><div><br><div><br><br><br><br><br><br><br></div></div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/1/12 Julien Saint-Martin <span dir="ltr"><<a href="mailto:julien.saintmartin@googlemail.com" target="_blank">julien.saintmartin@googlemail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div>Hi all,<br><br></div>I am currently trying to create a chugin with IBNIZ <a href="http://pelulamu.net/ibniz/" target="_blank">http://pelulamu.net/ibniz/</a> (it generate weird and loud sound, take care of your ears, headphones and speakers if you try it!!).<br>

</div>My target is to only have sound from it.<br><br></div>Ibniz source code is C, so I added the C file defining the functions I want to reuse inside the chugin make file:<br>C_MODULES=vm_slow.c<br><br></div>I call 3 of these functions inside the code generated by chuginate script: ibniz class defined in ibniz.cpp (chugin cpp source file)<br>

<br></div>Compilation seems ok except 2 warnings:<br><div><br><div><div><div>~/Chuck/chugins/ibniz$ make clean; make linux<br>rm -rf vm_slow.o ibniz.o ibniz.chug<br>gcc -D__LINUX_ALSA__ -I../chuck/include/ -fPIC -O3 -c -o vm_slow.o vm_slow.c<br>

g++ -D__LINUX_ALSA__ -I../chuck/include/ -fPIC -O3 -c -o ibniz.o ibniz.cpp<br>In file included from ibniz.h:12:0,<br>                 from ibniz.cpp:15:<br>vm.h:46:3: warning: anonymous type with no linkage used to declare variable '<anonymous struct> vm' with linkage [enabled by default]<br>

ibniz.cpp: In constructor 'ibniz::ibniz(double)':<br>ibniz.cpp:45:24: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]<br>gcc -shared -lstdc++ -o ibniz.chug vm_slow.o ibniz.o<br>

<br></div><div>Then I perform the: sudo make install<br><br></div><div>And the problem occurs when I try to launch a <a href="http://test.ck" target="_blank">test.ck</a> file<br></div><div>[<a href="http://test.ck" target="_blank">test.ck</a>]:line(1): undefined type 'ibniz'...<br>

[<a href="http://test.ck" target="_blank">test.ck</a>]:line(1): ... in declaration ...<br><br></div><div>I added verbose option 3 to check what goes wrong and I found that my ibniz.chug is not loaded cause of the following error:<br>
<br>
</div><div>[chuck]:(3:SEVERE):  |  | error loading chugin 'ibniz.chug', skipping<br>[chuck]:(3:SEVERE):  |  | error from chuck_dl: '/usr/lib/chuck/ibniz.chug: undefined symbol: _Z6vm_runv'<br><br></div><div>

vm_run() is one of the C functions I call in the chugin cpp file. So I suppose _Z6vm_runv is linked to it.<br><br></div><div>As a test, I tried to remove all these C functions and the chugin is loading and running. So I think I made something wrong to integrate these functions correctly inside the chugin code.<br>

<br></div><div>Any idea?<br></div><div>What is chuck_dl?<br><br></div><div>Thanks for your help.<br></div><div>Ju<br></div><div><br></div></div></div></div></div>
</blockquote></div><br></div>