[chuck-users] C function integration problem into a chugin

Julien Saint-Martin julien.saintmartin at googlemail.com
Sat Jan 12 08:43:35 EST 2013


Hi all,

I am currently trying to create a chugin with IBNIZ
http://pelulamu.net/ibniz/ (it generate weird and loud sound, take care of
your ears, headphones and speakers if you try it!!).
My target is to only have sound from it.

Ibniz source code is C, so I added the C file defining the functions I want
to reuse inside the chugin make file:
C_MODULES=vm_slow.c

I call 3 of these functions inside the code generated by chuginate script:
ibniz class defined in ibniz.cpp (chugin cpp source file)

Compilation seems ok except 2 warnings:

~/Chuck/chugins/ibniz$ make clean; make linux
rm -rf vm_slow.o ibniz.o ibniz.chug
gcc -D__LINUX_ALSA__ -I../chuck/include/ -fPIC -O3 -c -o vm_slow.o vm_slow.c
g++ -D__LINUX_ALSA__ -I../chuck/include/ -fPIC -O3 -c -o ibniz.o ibniz.cpp
In file included from ibniz.h:12:0,
                 from ibniz.cpp:15:
vm.h:46:3: warning: anonymous type with no linkage used to declare variable
'<anonymous struct> vm' with linkage [enabled by default]
ibniz.cpp: In constructor 'ibniz::ibniz(double)':
ibniz.cpp:45:24: warning: deprecated conversion from string constant to
'char*' [-Wwrite-strings]
gcc -shared -lstdc++ -o ibniz.chug vm_slow.o ibniz.o

Then I perform the: sudo make install

And the problem occurs when I try to launch a test.ck file
[test.ck]:line(1): undefined type 'ibniz'...
[test.ck]:line(1): ... in declaration ...

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:

[chuck]:(3:SEVERE):  |  | error loading chugin 'ibniz.chug', skipping
[chuck]:(3:SEVERE):  |  | error from chuck_dl: '/usr/lib/chuck/ibniz.chug:
undefined symbol: _Z6vm_runv'

vm_run() is one of the C functions I call in the chugin cpp file. So I
suppose _Z6vm_runv is linked to it.

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.

Any idea?
What is chuck_dl?

Thanks for your help.
Ju
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20130112/ec92f472/attachment.htm>


More information about the chuck-users mailing list