动态链接有两种类型,一种是程序加载时链接,另一种是程序运行时链接,以下分别是两个例子
- 程序加载时链接
//test_so_1.c
//需要include dlfcn.h
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
int main()
{
void *handle;
void (*myfunc1)();
char *error;
//open the so
handle = dlopen("./dll.so", RTLD_LAZY)