troubleshooting Question

Using dynamic linking instead of dlopen C++

Avatar of Jax Logan
Jax Logan asked on
Visual C++.NETNetworking Hardware-Other
1 Comment1 Solution347 ViewsLast Modified:
Experts,

I have some sample code that opens a library within the source code and creates a function handle (below). Instead I'd like to like to the library in my makefile but still use the same function in my source code. What would be the syntax for that?

Thanks!
/* Open the shared object */
 
    dl_handle = dlopen( "MyFunctionLib.so", RTLD_NOW );
 
    if (dl_handle)
 
    {
 
        /* Resolve the symbol (method) from the object */
 
        *(void **)(&fptr) = dlsym(dl_handle, "myFunction");
 
        if (func)
 
        {
 
            resource = (*func)(param);
 
        }
ASKER CERTIFIED SOLUTION
Let_Me_Be

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros