First the library called nanoGL is loading, I open the opengles-lite.so in the /lib folder. Good so far.
Then the orignal code would look up each function by its ordinal number. its appears linux does not work this way (maybe this is carry over from the windows land? The original was trying to open a dll)
Anyway the nanogl has a struct with pointers to each function. So the code would load each pointer incremenly with the address as loaded them.
int (*eglChooseConfig) (int dpy, const int *attrib_list, int *configs, int config_size, int *num_config);
int (*eglCopyBuffers) (int dpy, int surface, void* target);
int (*eglCreateContext) (int dpy, int config, int share_list, const int *attrib_list);
puts( "Getting functions by ordinal" );
memset( glEsImpl, 0, sizeof(GlESInterface));
int32_t** ptr = (int32_t**)(glEsImpl);
for (int count = 0; count < KGLEsFunctionCount; count++)
//*ptr++ = (int32_t*)(glesLib->Lookup(count+1));
snprintf(ordinal, sizeof(ordinal), "%d", count+1);
*ptr++ = (int32_t*)dlsym(glesLib,ordinal);
I need to get the function pointers in the struct to have the address in the library. using a symbol like "1" doesnt work. In linux is only by name of the function? How should I do this?