zoukankan      html  css  js  c++  java
  • extern C的使用

    每个函数都有一个标识,C语言和C++对函数的标识是不同的。

    今天在C++程序里面调用GeoIP(用C写的la静态库)里面的ip->as映射函数的时候,直接就可以调用,挺奇怪的,一看h文件里面有

     1 #ifndef GEOIP_H
    2 #define GEOIP_H
    3
    4 #ifdef __cplusplus
    5 extern "C" {
    6 #endif
    7
    8 #include <sys/types.h>
    9 #if !defined(_WIN32)
    10
    11 ……
    12
    13
    14 GEOIP_API void GeoIP_setup_custom_directory(char *dir);
    15 GEOIP_API GeoIP* GeoIP_open_type (int type, int flags);
    16 GEOIP_API GeoIP* GeoIP_new(int flags);
    17 GEOIP_API GeoIP* GeoIP_open(const char * filename, int flags);
    18 GEOIP_API int GeoIP_db_avail(int type);
    19
    20 ……
    21
    22 #
    23 #ifdef __cplusplus
    24 }
    25 #endif
    26
    27 #endif /* GEOIP_H */

    也就不足为奇了。。。

  • 相关阅读:
    撕衣服
    寒假作业1编程总结。
    C Traps and Pitfallss
    《彻底搞定C指针》文档整理
    C语言中内存分配 (转)
    ASCII
    ipad
    tour
    Diet
    第7章 输入与输出
  • 原文地址:https://www.cnblogs.com/tzhangofseu/p/2245476.html
Copyright © 2011-2022 走看看