简体   繁体   中英

Should i do malloc() before using dlopen()?

Below shown is the code snippet i am using. Should I allocate space using malloc before doing dlopen?

void* pvHandle = NULL;

/* Dynamically loading library */
pvHandle = dlopen ("libame.so", RTLD_LAZY | RTLD_GLOBAL);       
if (!pvHandle)
    {
        pszError = dlerror();
        cout << "Error : " << pszError;
    }

Please help me clear this doubt. Thanks in Advance.

不, dlopen会向库返回一个不透明的句柄,您不需要自己分配任何内存。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM