0

我正在做一个迁移项目。我需要将扩展​​名为 .ec 的 ESQL/C 文件转换为 gcc 上的 c 文件。我知道 ESQL/C 程序会创建一个 .c 文件。但我怎么能得到呢?

仅供参考:我正在研究 IBM Informix 服务器。

4

1 回答 1

3

TL;DR — 对于使用程序(脚本).ec编译的 Informix 文件,您可以使用“仅预处理,不编译或链接”选项。esql-e

esql -e esqlcode.ec

esqlcode.cesqlcode.ec. (忽略我之前关于“足够新”的评论;你不会使用不够新的版本——我的记忆又一次失败了。)

esql脚本传统上会留下中间.c文件。我的 ESQL/Cmake规则都将生成的.c文件作为单独的后编译步骤删除:

.ec.o:
    ${ESQL} ${ESQLFLAGS} -c $*.ec
    ${RM_F} $*.c

带有适当的后缀、宏等定义。

esql命令_

使用 Informixesql编译器(脚本),您可以在没有任何选项的情况下运行它以获得这样的帮助消息(不要害怕:实际上有两个命令的用法):

Usage: esql [-e] [-thread] [-glu] [esqlcargs] [-cc] [otherargs] [-o outfile]
            [-cp] [-onlycp] [-np] [-nup]
            [-libs] esqlfile.ec [othersrc.c...] [otherobj.o...] [-lyourlib...]

        -e         Preprocess only, no compilation or linking
        -thread    Multithread support
        -glu       Enable GLU (GLS for Unicode)
        -esqlcargs: esqlc arguments (-g, -G, -nln, -Ipathname, -nowarn, -V, -ansi,
                                    -xopen, -local, -log, -EDname, -EUname,
                                    -icheck
        -cc        Arguments after cc go to c compiler only
        otherargs: Other arguments are passed to cc
        -o         Next argument is program name
        -libs      Display the list of libraries used by esql at link time.
        -cp        Run C preprocessor before esqlc
        -onlycp    Run only the C preprocessor, no esqlc, compilation or linking
        -np        No protection of SQL keywords in SQL statements
        -nup       No unprotection of SQL keywords, forces -onlycp


Usage: esqlc [-thread] [-gG] [-nln] [-Ipathname] [-nowarn] [-V] [-ansi]
             [-static] [-xopen] [-local] [-log file] [-EDname[=val]] [-EUname]
             [-icheck] [-keepccomment] [-version] esqlfile.ec
         -thread     Multithread support
         -g          Number every line (debugging purposes)
         -G          No line number (debugging purposes; same as -nln)
         -nln        No line number (debugging purposes; same as -G)
         -Ipathname  Add pathname to include file search path
         -nowarn     Do not print warnings
         -static     Link with static libraries
         -keepccomment Allow C style comments in SQL statements.
         -version    Displays build and version information.
         -V          Print preprocessor version information
         -ansi       Perform ANSI checking
         -xopen      Perform XOPEN checking
         -local      Make cursor/statement ids local to the file
         -log file   Log error and warning messages in file
         -EDname     Define specified preprocessor name flag
          [=val]     and set it equal to 'val'
         -EUname     Undefine specified preprocessor name flag
         -icheck     Check for indicator variables

foresqlc用于“真正的”预处理器,$INFORMIXDIR/lib/esqlc. foresql用于esql脚本本身——这是您主要使用的。esqlcargs用法中的esql是列出的那些esqlc——它们由脚本传递给程序。

此输出来自与 Informix 12.10 关联的 ESQL/C 4.10。我不会对 ESQL/C 版本号的历史感到厌烦。

于 2017-05-22T22:08:28.207 回答