c++ - How can I cast or convert boost bind to C function pointer? -


suppose have this:

void func(wchar* pythonstatement) {   // pythonstatement } 

and need convert void function(void) this:

bind(func, text("console.write('test')")) 

now have struct this:

typedef void (__cdecl * pfuncplugincmd)();  struct funcitem { pfuncplugincmd pfunc;     // ... }; 

how can set pfunc of struct bind(func, "something")? bind returns lambda_functor not function pointer, how can cast functor function pointer?

thanks.


ended using the wrapping "solution" (github)

i think can't, unless make resulting lamba_functor global variable.

in case, declare function invokes it:

void uglyworkaround() {     globallambdafunctor(); } 

and set pfunc uglyworkaround().

edit
sidenote: if binding static text function call, may omit bind() call , write just:

void wrapper() {     func(text("console.write('test')")); } 

and set pfunc wrapper().


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -