Problems with function as parameter

Matt Jones matthew.brennan.jones at gmail.com
Thu Sep 21 22:05:22 UTC 2017


On Thursday, 21 September 2017 at 20:21:58 UTC, Josh wrote:
> I'm trying to write a callback function for SDL_mixer through 
> Derelict, but this is the first time I've tried to use a 
> function as a parameter, and so I think I'm just making a minor 
> mistake somewhere.
>
> [...]

Make it a C function, not a D function:

extern (C) void channelDone(int channel)
{
	unmuteMusic();
}

and use & to reference the function instead of calling it:

Mix_ChannelFinished(&channelDone);


More information about the Digitalmars-d-learn mailing list