Thread overview
argh! seg fault. - testvorbis2.d
Jun 14, 2004
clayasaurus
Jun 14, 2004
Ben Hinkle
Jun 14, 2004
clayasaurus
Jun 14, 2004
Mike Parker
June 14, 2004
hello, i'm in the process of trying to get openal to work with d. i've tried converting the following code to D (i think this is where the problem lies, because my printf's never get past the alutLoadVorbis function).

c code...
typedef ALboolean (vorbisLoader)(ALuint, ALvoid *, ALint);
vorbisLoader *alutLoadVorbisp = NULL;

..etc

alutLoadVorbisp(vorbbuf, data, size);

d code...
/* our vorbis extension */
alias ALboolean (vorbisLoader)(ALuint, ALvoid *, ALint);
vorbisLoader *alutLoadVorbisp = null;

..etc

alutLoadVorbisp(vorbbuf, data, size);

i've attached the whole file incase someone wants to take a look at what else might be causing the problem. i also have code like this

if(stat(fname, &sbuf) == -1)
{
return -1;
}

printf("got stat info\n");

size = sbuf.st_size;
data = malloc(size);
if(data == null) {
exit(1);
}

in here that might be causing the problem. i dunno. any help would be highly appreciated. thx.


June 14, 2004

> if(data == null) {

you probably want "data is null" since == will seg-v if data is null. Most of time == in C should be converted to "is" in D and != to either !== or !(.. is ..)



June 14, 2004
In article <cakrar$1rgd$1@digitaldaemon.com>, Ben Hinkle says...
>
>
>
>> if(data == null) {
>
>you probably want "data is null" since == will seg-v if data is null. Most of time == in C should be converted to "is" in D and != to either !== or !(.. is ..)
>
>
>

well i changed == to is and != to !== , but it still seg faults in the same place.


June 14, 2004
In article <caksmr$1u72$1@digitaldaemon.com>, clayasaurus says...
>
>In article <cakrar$1rgd$1@digitaldaemon.com>, Ben Hinkle says...
>>
>>
>>
>>> if(data == null) {
>>
>>you probably want "data is null" since == will seg-v if data is null. Most of time == in C should be converted to "is" in D and != to either !== or !(.. is ..)
>>
>>
>>
>
>well i changed == to is and != to !== , but it still seg faults in the same place.
>
>

Just a thought: is "data" on the stack, or inside of a class?  Maybe the *location* of data is no good, rather than just it's value.

- Eric


June 14, 2004
clayasaurus wrote:

> hello, i'm in the process of trying to get openal to work with d. i've tried
> converting the following code to D (i think this is where the problem lies,
> because my printf's never get past the alutLoadVorbis function). 

> in here that might be causing the problem. i dunno. any help would be highly
> appreciated. thx. 
> 
> 

You might want to compile and run the C version as well, if you are using the latest version of OAL and haven't run it already. I've heard several reports of crashing since when using the latest.