如何使用代码块为MIGW构建64位版本的Oracle OCI静态库(libocia/w/m.a)

How to build 64 bit version of Oracle OCI static libraries (libocia/w/m.a) for MIGW using Code blocks?

本文关键字:libocia 静态 OCI Oracle 代码 何使用 MIGW 构建 版本 64位      更新时间:2023-10-16

有人知道如何构建64位版本的Oracle OCI静态库吗?

我从http://sourceforge.net/projects/orclib/files/下载了ocilib-3.12.1-windows.zip (2.9 MB)

得到这个ocilib_static_lib_mingw。/proj文件夹下的CBP项目。它在Migw GCC 32位下编译良好。但是,它不能在64位Migw下编译GCC 64位

-------------- Build: Release - ANSI in ocilib_static_lib_mingw (compiler: Mingw/TDM 64)---------------
x86_64-w64-mingw32-gcc.exe -O2 -Wall -DOCI_CHARSET_ANSI -DOCI_IMPORT_RUNTIME -DOCI_API=__stdcall -IC:ocilibinclude -c C:ocilibsrcagent.c -o objReleasesrcagent.o
In file included from C:ocilibsrcoci_defs.h:58:0,
                 from C:ocilibsrcoci_api.h:58,
                 from C:ocilibsrcoci_import.h:63,
                 from C:ocilibsrcocilib_defs.h:39,
                 from C:ocilibsrcocilib_types.h:38,
                 from C:ocilibsrcocilib_internal.h:38,
                 from C:ocilibsrcagent.c:35:
C:ocilibsrcoci_types.h:253:25: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'ubig_ora'
 typedef unsigned _int64 ubig_ora;
                         ^
C:ocilibsrcoci_types.h:254:25: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'sbig_ora'
 typedef   signed _int64 sbig_ora;

C: ocilib src oci_types.h

#ifdef _WIN64
  #ifndef lint
253: typedef unsigned _int64 ubig_ora;
254: typedef   signed _int64 sbig_ora;
  #else
    #define ubig_ora unsigned _int64
    #define sbig_ora signed _int64
  #endif

我没有关于"expected " = "…"错误的线索

I看起来像是检测到Windows平台,因此假设使用了MSVC编译器。旧版本的MSVC不支持int64_t这样的类型定义(但它们有自己的INT64或_int64版本)。因为你的项目是纯C(没有c++)

像这样做:

#ifdef _WIN64
# if defined(_MSC_VER)
#   ifndef lint
typedef unsigned _int64 ubig_ora;
typedef   signed _int64 sbig_ora;
#   else
#   define ubig_ora unsigned _int64
#   define sbig_ora signed _int64
#   endif
# elif defined(__MINGW64__)    
#   include <stdint.h>
typedef uint64_t ubig_ora;
typedef int64_t sbig_ora;
# endif
...

~