Calling C functions with D function pointers as operands
    Zarathustra 
    adam.chrapkowski at gmail.com
       
    Sat Apr 26 08:54:20 PDT 2008
    
    
  
How can I call C functions with D function pointers as operands?
I tried this:
	// gl2psUserWritePNG & gl2psUserFlushPNG are static
	void function(png_struct*, ubyte*, uint) gl2psUserWritePNG_ptr
= &gl2psUserWritePNG;
	void function(png_struct*)
gl2psUserFlushPNG_ptr = &gl2psUserFlushPNG;
	png_set_write_fn(
		png_ptr,
		cast(void*)png,
		gl2psUserFlushPNG_ptr,
		gl2psUserFlushPNG_ptr
	);
but there are some errors:
 Error: cannot implicitly convert expression (gl2psUserWritePNG_ptr)
of type void function(png_struct*, ubyte*, uint) to voidC  function
(png_struct*, ubyte*, uint)
 Error: cannot implicitly convert expression (gl2psUserFlushPNG_ptr)
of type void function(png_struct*) to voidC  function(png_struct*)
    
    
More information about the Digitalmars-d-learn
mailing list