Page 1 of 2

ID3LIB - Standard GNU MP3 Tagging library

Posted: Tue May 10, 2005 11:54 am
by naw
Has anyone out there used this with PB?

http://id3lib.sourceforge.net/

- seems to be the standard lib that all the main media players use - would be nice if it worked with PB too!

BTW I just downloaded MediaMonkey. I bought a copy of MusicMatch a couple of years ago, I love it but its beginning to collapse under its own weight of features. MediaMonkey seems to have taken the essential feature of MMJB, iTunes etc and is a nice alternative... (it also apparently uses ID3LIB)

Ta - N

Posted: Tue May 10, 2005 4:06 pm
by KarLKoX
ID3lib is a C++ lib wich can't be used as a library, btw, you can use the dllimport to import functions and call them like standard functions (with the "_" char)
There is the possiblity to use my unfinished read/write tagger (it also read mp3 header even vbr ones) : click here (source code here)

Posted: Tue May 10, 2005 4:47 pm
by traumatic
KarLKoX wrote:ID3lib is a C++ lib wich can't be used as a library
You can always write a C-wrapper without too much hassle.

The beginning of a wrapper is even included in the pack, wrapping additional
functions shouldn't be that hard. There're already user-patches wrapping more
functions. Other than that, yeah, simply use the DLL-version.

Posted: Tue May 10, 2005 7:17 pm
by KarLKoX
traumatic wrote:
KarLKoX wrote:ID3lib is a C++ lib wich can't be used as a library
You can always write a C-wrapper without too much hassle.
No, this is impossible : i allready tried the C wrapper for the libmodplug (this is an example) but as pelle's* is only a C compiler it can't resolved C++ symbols.
I played a lot with the linker <--> purebasic and i never found a way to use C++ code within a purelibrary (even a simple "hello world").
If you got a solution you ll be very HELPFUL ! :D


* The 3.0 build is available :)

Posted: Tue May 10, 2005 7:27 pm
by Polo
KarLKoX wrote:
traumatic wrote:
KarLKoX wrote:ID3lib is a C++ lib wich can't be used as a library
You can always write a C-wrapper without too much hassle.
No, this is impossible : i allready tried the C wrapper for the libmodplug (this is an example) but as pelle's* is only a C compiler it can't resolved C++ symbols.
I played a lot with the linker <--> purebasic and i never found a way to use C++ code within a purelibrary (even a simple "hello world").
If you got a solution you ll be very HELPFUL ! :D


* The 3.0 build is available :)
You can use Visual C++, it works with it ;)

Posted: Tue May 10, 2005 7:37 pm
by KarLKoX
This is what i do to create the lib but don't forget that purebasic use the pelles'c linker to create it's executable :wink:

Posted: Tue May 10, 2005 7:39 pm
by Polo
Fred told me in another topic that PellesC's linker can link c++ object files :)
And this seems to be true :)

Posted: Tue May 10, 2005 7:40 pm
by Fred
The problem is the symbol 'mangling' of C++, it's not a linker problem. You can perfectly link VC++ .lib if you declare the functions which needs to be exported as 'extern C {}' then the symbol is correctly generated. Then you can use C++ function in a C function (like new, etc..)

Posted: Tue May 10, 2005 7:45 pm
by KarLKoX
The pb didn't come from my exported function wich are all exported with the extern "C" but from other symbols like _rtti, _$text and others wich i can't remember.
I ll try to make a simple package to show you if it works or not.

Posted: Tue May 10, 2005 7:47 pm
by Fred
yes, this would be an interesting try

Posted: Tue May 10, 2005 8:03 pm
by KarLKoX
IT WORKS ???! This is really wired ... i tried a lot with lcc but never got it working ...
I ll see if i can compile a big project like libmodplug or ... id3lib but it seems that i was wrong somewhere, sorry :oops:

Posted: Tue May 10, 2005 8:23 pm
by traumatic
Of course it works. Its just a matter of extern "C" as Fred said.
I did this a few times with success. Besides wrapping C++, I can't
imagine how I would survive with just plain C. I'm using this 'hybrid approach'
on a daily basis. (IIRC I already told you this in another thread some time ago) ;)

Posted: Tue May 10, 2005 8:40 pm
by KarLKoX
This was not a extern "C" as i compiled a lot of userlib with success (with the right calling conv), my pb occured when i was mixing my C code for my C library with a third C++ lib (libmodplug) : this lib allready have a C wrapper with the extern "C" keyword so it can't be a extern "C" pb.
And i never got errors related to a "un-exported" function, it was always for some exe section or some kind of (bsdata, _rtti, __$text ...)
Note this was the case with the lcc linker (pb 3.81 and <) and this is my second try with pelles'c.

Posted: Tue May 10, 2005 9:09 pm
by traumatic
Be sure to tell us about your progress. :)

Posted: Tue May 10, 2005 9:31 pm
by KarLKoX
No pb, first i won't adapt id3lib, there must be a lot of work done to get it working : function return classes, some classes use template --> they must be wrapped to generic functions and there are a lot !
But i ll try with libmodplug wich is better than midas and would be a better alternative.