当前位置: 技术问答>linux和unix
新手:Linux下使用第三方C库(openssl),是调用.so文件还是直接调用.h文件?
来源: 互联网 发布时间:2016-08-23
本文导语: 新手:Linux下使用第三方C库(openssl),是调用.so文件还是直接调用.h文件? | 头文件和库文件都是必须的呀 | .a是静态链接库,.so是动态的,两者都要include.h文件,静态的可...
新手:Linux下使用第三方C库(openssl),是调用.so文件还是直接调用.h文件?
|
头文件和库文件都是必须的呀
|
.a是静态链接库,.so是动态的,两者都要include.h文件,静态的可以直接调用它里面的方法,动态库要
#include
#include
int main ( int argc, char * argv[] )
{
void * libc;
void ( * printf_call ) ();
if ( ( libc = dlopen( "/lib/libc.so.6", RTLD_LAZY ) ) != 0 )
{
printf_call = dlsym( libc, "printf" );
( *printf_call )( "hello, worldn" );
}
return 0;
} /* end of main */
参考资料:http://www.linuxforum.net/forum/showflat.php?Board=program&Number=124803
#include
#include
int main ( int argc, char * argv[] )
{
void * libc;
void ( * printf_call ) ();
if ( ( libc = dlopen( "/lib/libc.so.6", RTLD_LAZY ) ) != 0 )
{
printf_call = dlsym( libc, "printf" );
( *printf_call )( "hello, worldn" );
}
return 0;
} /* end of main */
参考资料:http://www.linuxforum.net/forum/showflat.php?Board=program&Number=124803
|
如果你要调用openssl的函数接口,包含.h文件就可以了,我当初写openssl的程序的时候就直接包含的.h文件。
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。