dlopen not working as expected, help needed
hi this is my code. here i am trying to build a library of this code and do LD_PRELOAD of it so that i can dynamically add libmymemcopy to LD_PRELOAD. i want if the executable/application with name "repeat" is called then memcopy should be done by my library. correct me if i am wrong.
Code:
#include <stdio.h>
#include <string.h>
#include <dlfcn.h>
extern char *program_invocation_short_name;
static void the_stump(void) __attribute__((constructor));
void the_stump(void)
{
if(!strcmp(program_invocation_short_name,"repeat"));
{
dlopen("libmymemcpy.so.1", RTLD_NOW | RTLD_GLOBAL);
}
}