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