Category : function-pointers

hello and thanks in advance for supporting, I’m trying to send a pointer to function which is type void and receive nothing. it didn’t work well so far. here is my minimal code that have this problem: void func::foo() { return; } and the function which use it is: void func::create_func(void(*wanted_func)()) { wanted_func(); } the ..

Read more

We have a ndk library with initializing code like these: extern GL_APICALL void (*GL_APIENTRY glReadBuffer)(GLenum mode); glReadBuffer = (void*) eglGetProcAddress("glReadBuffer"); However, some android apps with this library always crash at function call eglGetProcAddress. Other apps with the same library won’t. eglGetProcAddress is a funciton provided by android system, generally in libegl.so. So I suppose that ..

Read more

I have written a c++ dll, which allows me to register a callback function from the main application. This is the according code in the dll: extern "C" { typedef void(__stdcall* callbackRead_t)(UCHAR* Buffer, ULONG* BufferSize); static callbackRead_t s_user_functionRead = nullptr; // variable used to store the user function address __declspec(dllexport) void public_readfunc_taking_callback(callbackRead_t evHnd) { s_user_functionRead ..

Read more

I was reading through some code and I found a case where a function pointer (the address, not the type) is passed to a template parameter. // connects a free function registry.on_construct<position>().connect<&my_free_function>(); // connects a member function registry.on_construct<position>().connect<&my_class::member>(instance); I have not seen this before. As I thought only types and integers can be passed to ..

Read more

I am writing a program whose behaviour is to be controlled by user-defined settings, provided through a plain ASCII configuration file including keywords and values. Since not all keywords may be provided by the user, there are also "built-in" settings. The configuration values provided for different keywords will affect variables (all part of settings class) ..

Read more

struct Subject { char SubName[30]; int Hakjumm; char Grade[10]; float GPA; }; struct Student { char StdName[30]; int Hakbun; Subject* Sub; int SubNum; float AveGPA; }; This function searches for the student’s name in the structure and returns the address of the student’s name if there is a matching student. Student* StdSearch(Student* pSt, char name[]) ..

Read more