Very vague compiler error message

Jeremy DeHaan via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Aug 17 23:00:41 PDT 2014


I didn't have access to my compute for longer than I thought, but 
I finally got around to this.

After some messing around, I not only managed to track down the 
cause, but I got it fixed and the Audio module for DSFML is back 
to where it was.


In one of my D classes, SoundStream, I defined a struct called 
Chunk, which held a chunk of sound data. It looks like this:

struct Chunk
{
   const(short)* samples;
   size_t sampleCount;
}


All of the streaming is actually happening in an extern(C++) 
interface instance, and with the help of Dustmite, the method 
that caused the initial error was this:

extern(C++) bool onGetData(SoundStream.Chunk* chunk);

I think because it has a D Class member as the parameter type in 
an extern(C++) class method the D compiler broke?

What I did to fix it was I changed Chunk from being a member of 
SoundStream and declared it as a extern(C++) struct instead.  
That changed onGetData to "extern(C++) bool onGetData(Chunk* 
chunk);" and the compiler was ok with that.

I might do some more testing to see if I can reproduce the error, 
but changing the parameter type fixed it for me.




More information about the Digitalmars-d-learn mailing list