testso.c

来自「此源码是著名的教材BeginningLinux Programming中文名字叫」· C语言 代码 · 共 30 行

C
30
字号
#include <stdio.h>
#include <dlfcn.h>

int main(void)
{
	void	*handle;
	char	*error;
	void	(*welcome)( ); 
	
	if ((handle = dlopen("./libttt.so", RTLD_LAZY)) == NULL) 
	{
		printf ("dlopen error\n");
		exit (1);
	}
	
	welcome = dlsym(handle, "welcome");
	if ((error = dlerror()) != NULL)
	{
		printf ("dlsym error\n");
		exit (1);
		
	}
	
	welcome ();
	
	dlclose (handle);
	
	exit (0);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?