Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Not many hoops, why?

    /* Create function pointer of appropriate type, initialised. */
    int(*foo)(int, int) = NULL;
    
    int main()
    {
        void * ha;
        
        if ((ha = dlopen("A", RTLD_LAZY|RTLD_NODELETE)) != NULL) {
            foo = dlsym(ha, "foo");
            dlclose(ha);
        }
        
        /* if "foo" is non-NULL you can call it now. */
        
        ...


If you control the development of both A and B apps, then not so many. But generally you are not expected to load symbols from another application, you are expected to either use various IPC mechanisms or load symbols from a shared library instead of touching another application at all.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: