在制作dll的时候,如果全局变量不导出,而函数调用中,包含了全局变量,那么会出现全局变量没有值的问题。
add.c
#pragma once //强制无签名utf-8 #include "add.h" pStu student;//全局变量 int add(int a, int b){ return a + b; } void test1(pStu p){ if (p == NULL){ printf("------1------\n"); } //全局变量怎么处理 if (student == NULL){ printf("------2------\n"); } else{ printf("ok\n"); } }