callback parameter order question

gedaiu szabobogdan at yahoo.com
Sat May 11 03:44:00 PDT 2013


On Saturday, 11 May 2013 at 10:04:54 UTC, Andrej Mitrovic wrote:
> On 5/11/13, gedaiu <szabobogdan at yahoo.com> wrote:
>> if i do that, i get this error
>
> I don't know what "ahc_echo" is, but I imagine you'll have to 
> make it
> an extern(C) function.

Hi,


i have this code, and i don't think i can add extern(C) there

void start() {

auto ahc_echo = function(void* cls,
	MHD_Connection* connection,
	const char *url,
	const char *method,
	const char *ver,
	const char *upload_data,
	size_t *upload_data_size,
	void **ptr) {
	        ...
};

d = MHD_start_daemon(MHD_FLAG.MHD_USE_THREAD_PER_CONNECTION, 
8080, null, null, ahc_echo, null, MHD_OPTION.MHD_OPTION_END);

}


and if i create a function like this:


extern(C) int ahc_echo(void* cls,
	MHD_Connection* connection,
	const char *url,
	const char *method,
	const char *ver,
	const char *upload_data,
	size_t *upload_data_size,
	void **ptr) {
....
};


i get this error:
Error: function cmsutils.CMServer.ahc_echo (void* cls, 
MHD_Connection* connection, const(char*) url, const(char*) 
method, const(char*) ver, const(char*) upload_data, ulong* 
upload_data_size, void** ptr) is not callable using argument 
types ()

Error: expected 8 function arguments, not 0


More information about the Digitalmars-d-learn mailing list