在制作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");
    }
}
View Code

相关文章:

  • 2021-10-26
  • 2021-07-17
  • 2021-11-17
  • 2021-09-29
  • 2022-12-23
  • 2022-12-23
  • 2021-08-16
猜你喜欢
  • 2021-08-10
  • 2021-04-18
  • 2021-11-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-09
相关资源
相似解决方案