On 2011-07-01 11:13, Marco Cosentino wrote:
On 01/07/2011 00:30, Andrej Mitrovic wrote:
Try this:
int
process (jack_nframes_t nframes, void *arg)
->
extern(C) int
process (jack_nframes_t nframes, void *arg)
Thank you Andrej, that solved the problem!
Please can you biefly explain me what happens in the stack when calling
that function with and without the "extern(C)" declaration?
I think that the D language would benefit from a deep, complete and open
guide on how to _practically_ interface with C, accounting some popular
designs cases not just a bunch of trivial cases like using 'printf' and
a translation table of base types.
Marco
What happens without "extern(C)" is that the function will use the D
calling convention, with it, it will use the C calling convention. The C
code your interfacing with excepts functions and function pointers with
the C calling convention.
See:
http://www.digitalmars.com/d/2.0/interfaceToC.html
http://www.digitalmars.com/d/2.0/htomodule.html
--
/Jacob Carlborg