[PD] C++ for reusable dsp lib - or better use C?

IOhannes m zmoelnig zmoelnig at iem.at
Tue Feb 21 17:00:51 CET 2012

Hash: SHA1

On 2012-02-21 16:36, katja wrote:
> Hello,
> I'd like to know opinions from experienced developers about the use of
> C versus C++ for dsp libs.
> I'm planning to write a compact library with audio analysis functions,
> to be used with Pd in the first place, but meant to be portable to
> other real time dsp frameworks. This project will contain several
> routines which must share one interface to Pd, and C++ will be most
> convenient for it. I've used C and C++ for Pd classes before, and both
> seem to work properly and efficient. But I lack experience to know on
> beforehand if there is some disadvantage of using C++ for a reusable
> dsp library. This will be my first. Quite some dsp libs are written in
> C, even today. Is there good reason to refrain from C++'s conveniences
> for writing classes, and use C instead?

one problem with C++ is that name-mangling is different depending on
which compiler/linker you are using.
this basically means, that you cannot use your C++-library binary made
with g++ in an application/... build with e.g. M$VC.

note that you can avoid this, if you provide a public "C" API, and use
C++ only as an implementation detail (e.g. and pass classes around as
anonymous structs)

Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3636 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20120221/c726bb0c/attachment.bin>

More information about the Pd-list mailing list