Re: [fpc-pascal] Get value of PPChar ?

2017-04-16 Thread Sven Barth via fpc-pascal
On 16.04.2017 18:52, fredvs wrote: > Free Pascal - General mailing list wrote >> function mpg123_icy(mh: Tmpg123_handle; var icy_meta: PChar): Integer; >> cdecl; > > Thanks for your answer. > > I did try with this but : > > res := mpg123_icy(mph,theicytag); > > if (res = 0) then

Re: [fpc-pascal] Get value of PPChar ?

2017-04-16 Thread fredvs
Free Pascal - General mailing list wrote > According to the code it also returns 0 with icy_meta being Nil if there > is no corresponding data: > https://github.com/georgi/mpg123/blob/master/src/libmpg123/libmpg123.c#L1384 Ha, nice, you did find the only doc available : the source code (that

Re: [fpc-pascal] Get value of PPChar ?

2017-04-16 Thread Andrew Haines via fpc-pascal
On 04/16/2017 10:58 AM, fredvs wrote: K, the function seems to work because the result = 0 (no error). But how to retrieve the data icy_meta (PPChar) ? var theicytag : PPChar; resu : integer; ... resu := mpg123_icy(ahandle, theicytag); if resu = 0 then writeln(theicytag^); --> raise exception

Re: [fpc-pascal] Get value of PPChar ?

2017-04-16 Thread Christo Crause
I suppose you have to allocate memory and create a pointer to a pointer to this memory which you pass to the function. On 16 Apr 2017 4:58 PM, "fredvs" wrote: > Hello. > > A C method is defined like this: > > MPG123_EXPORT int mpg123_icy(mpg123_handle *mh, char **icy_meta); >

Re: [fpc-pascal] Get value of PPChar ?

2017-04-16 Thread fredvs
Free Pascal - General mailing list wrote > resu := mpg123_icy(ahandle, theicytag); > if (resu = 0) and Assigned(theicytag) and Assigned(theicytag^) > then writeln(theicytag^); Hello and thanks for answer. Indeed, that way no more crash but also nothing from writeln(theicytag^). I did a check

Re: [fpc-pascal] Get value of PPChar ?

2017-04-16 Thread fredvs
>And how you'll need to use it will depend upon the function's documentation Huh, you did not know ? With audio libraries there is a law: NO doc (other that the C header) and NO demos. So you must guess and explore all by your self. Fre;D - Many thanks ;-) -- View this message in

Re: [fpc-pascal] Get value of PPChar ?

2017-04-16 Thread Sven Barth via fpc-pascal
On 16.04.2017 16:58, fredvs wrote: > Hello. > > A C method is defined like this: > > MPG123_EXPORT int mpg123_icy(mpg123_handle *mh, char **icy_meta); > > and translated in Pascal with this: > > function mpg123_icy(mh: Tmpg123_handle; var icy_meta: PPChar): integer; > cdecl; This is wrong.

Re: [fpc-pascal] Get value of PPChar ?

2017-04-16 Thread fredvs
Christo Crause wrote > I suppose you have to allocate memory and create a pointer to a pointer to > this memory which you pass to the function. Hello and thanks for answer. Huh, ok, but how do you do this by code ? Fre;D - Many thanks ;-) -- View this message in context:

Re: [fpc-pascal] Get value of PPChar ?

2017-04-16 Thread fredvs
Free Pascal - General mailing list wrote > function mpg123_icy(mh: Tmpg123_handle; var icy_meta: PChar): Integer; > cdecl; Thanks for your answer. I did try with this but : res := mpg123_icy(mph,theicytag); if (res = 0) then writeln('resu = ' + inttostr(res)); // OK = 0 if

Re: [fpc-pascal] Get value of PPChar ?

2017-04-16 Thread fredvs
Bart-48 wrote > If you know that res equals 0, then a simple writeln('resu = 0'); would > suffice. > Second, there is no need do an inttostr(res) inside write(ln). > Write(ln) is perfectly capable of writing integers (as it has been Huh, of course I know all this, sorry, I just mixed copy paste

[fpc-pascal] Get value of PPChar ?

2017-04-16 Thread fredvs
Hello. A C method is defined like this: MPG123_EXPORT int mpg123_icy(mpg123_handle *mh, char **icy_meta); and translated in Pascal with this: function mpg123_icy(mh: Tmpg123_handle; var icy_meta: PPChar): integer; cdecl; OK, the function seems to work because the result = 0 (no error). But