If it makes you feel better, you can write &(ascii_sig[0])
;-)
David_Swe
ok =)
yalaforge
Where's the problem with the code snippet?
David_Swe
It's something with the returning of the chars and getting them to a string
yalaforge
From which library is this function? It seems it isn't from libmusicbrainz.
I could test it if you tell me :-)
David_Swe
=). I know that musicbrainz work...
It's from the TRM generator
yalaforge
Ah, got it. I'm there.
David_Swe
The example works...for C++ users.=)
yalaforge
There isn't much difference to C in this case.
You copied MP3_generateTRM() to your own code?
David_Swe
Hell no! I use the dll =)
icepick
morning
yalaforge
icepick: hi
icepick tries to read with eye's sleep encrusted
David_Swe
america?
yalaforge
Looks like some basic C++ problems.
David_Swe: Can you put your source file online?
David_Swe
It's in pascal..=)
icepick
EST
yalaforge
pascal, oh dear.
David_Swe
=)
icepick
David_Swe: ascii_sig is going to be always ... uhh... 17 chars?
and it most likely won't be null term...
but i've not used trm.dll
David_Swe
Hmm..Il try
yalaforge hasn't even heard of trm.dll
icepick
is that from tunepimp?
yalaforge
Don't think so. It's from mp3_trm.cpp
which is in trm-0.2.1
icepick
ok...
David_Swe
Im going mad
yalaforge
David_Swe: So you want to call a C++ function from trm.dll from pascal?
David_Swe
yes
yalaforge isn't the brightest guy around
yalaforge
The second argument needs to be a pointer. That pointer should point to a buffer which is large enough.
David_Swe
100
array of ansichar
icepick
David_Swe: found it ... no it should be 37
yalaforge
So why not define an array of type ansichar, and a pointer that points to the first element of that array. Then pass the pointer as the second argument to the function.
icepick
and it is null terminated
the beginning of an array is a pointer in C
David_Swe: what pascal complier are you using?
David_Swe
Borland pascal 7
Is it ansi?
yalaforge
it should be ascii, which is a subset
David_Swe
ok
yalaforge
If your ansichar base type is 1 byte wide, it should be OK
VAR ascii_sig: ARRAY[0..37] OF ansichar;
Or something like that. Don't remember properly.
David_Swe
So why doesn't it work =)
yalaforge
It is certain, that MP3_generateTRM(..., ascii_sig[0], ...) won't work
you need the address of ascii_sig, don't know how that is done in pascal
David_Swe
@ascii_sig[0]
icepick
ascii_sig is a c string... does that help?
yalaforge
then try MP3_generateTRM(..., @ascii_sig[0], ...)
David_Swe
Well if I knew what a c string is.......=)
yalaforge
David_Swe: a C string is simply an array of char's. Terminated with ASCII NUL.
icepick nods
David_Swe
Mmm..I wonder if its the same as shortstring in pascal
yalaforge
You can easily print it: i = 0; while ascii_sig[0] != 0 begin print ascii_sig[i]; i:=i+1; end.
oops: i = 0; while ascii_sig[i] != 0 begin print ascii_sig[i]; i:=i+1; end.
David_Swe: no, it's no shortstring. AFAIK in shortstring, the length is coded in the 0's element.
David_Swe
Aha...how=
?
yalaforge
David_Swe: in shortstring, I thought. In C, a string works that way:
str[0]='H'; str[1]='i'; str[2]='!'; str[3] = 0;
Which is the string 'Hi!'
David_Swe
=)
Ill try
yalaforge
Ok, good luck
It's a messy thing to use pascal with libraries written for C. I tried that with Delphi, 5 years ago.
BTW: The first argument to MP3_generateTRM() has to be a C string, too.
David_Swe
You went over from delphi to c?
yalaforge
No, I just had a look at delphi for about half a year.
I used C before and after that.
Perhaps it would be a good idea to look for (or write) conversation functions for mapping between pascal and C strings.
David_Swe
Well there are a lot built in i pascal but they result in the same error
I think it's maybe the dll refusing to let go if the memory space........=/
yalaforge
Hm, that's bad. Probably you should ask someone on a pascal channel or newsgroup. I can't help very much due to lacking knowledge.