LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Compiling a C++ plugin for XMMS (https://www.linuxquestions.org/questions/programming-9/compiling-a-c-plugin-for-xmms-507182/)

neodelphi 12-03-2006 03:52 PM

Compiling a C++ plugin for XMMS
 
Hello,

I recently developped a plugin for XMMS written in C. It worked really fine. Now I would like to write a plugin for XMMS in C++, so I changed the extension of my source (from main.c to main.cpp) and I compiled it with g++ instead of gcc.

This doesn't work, XMMS don't recognize my plugin. I tried to find the reason with nm, and these are extract from the output of nm:

Shared library, C version:
...
000017c4 d __JCR_END__
000017c4 d __JCR_LIST__
w _Jv_RegisterClasses
000005ca t plug_about
000005a4 t plug_cleanup
000005f0 t plug_configure
...


Shared libray, C++ version:
...
00001900 D plug_vtable
000018e4 d p.4462
U puts@@GLIBC_2.0
00000582 t _Z11plug_initv
000005ce t _Z12plug_aboutv
000005a8 t _Z14plug_cleanupv
0000056c T _Z16get_vplugin_infov
...


As we can see, the C++ version has _Z prefixes and I think this is why XMMS can't use the plugin. is there a g++ option which can remove the prefixes ? Is it possible to write a C++ plugin for a program written in C ?

Thanks for answering.
neodelphi

paulsm4 12-03-2006 04:00 PM

Hi -

You can definitely write your plug-in in C++: no problem.

But you need to declare all the symbols you're exporting with
Quote:

extern "C" { ...}
'Hope that helps .. PSM

neodelphi 12-04-2006 02:27 PM

Thank you for answering, I think this could solve my problem. I'll try to look at these and formations.

In fact a friend and I wrote a C++ openGl engine, and I'd like to use it for xmms (just for fun).

thx,
neodelphi


All times are GMT -5. The time now is 05:20 AM.