【问题标题】:Code compiles on AIX 5.3 but not AIX 7.1 something to do with struct shl_descriptor where is this defined?代码在 AIX 5.3 上编译,但不是在 AIX 7.1 上编译与 struct shl_descriptor 相关的定义在哪里?
【发布时间】:2011-05-13 22:20:30
【问题描述】:

我有一些类似于以下的代码:

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/errno.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <stdarg.h>
#include <sys/ldr.h>

int main (int argc, char **argv)
{
   int                      liRC = 0;
   struct shl_descriptor    *lstModDesc;
   int                      liEach;
   char                     lsBaseName[513];
   char                     *lsTheName;

   for( liEach = 0; liRC == 0; liEach++ )
   {
      liRC = shl_get( liEach, &lstModDesc );
      if( liRC == 0 )
      {
         strcpy( lsBaseName, lstModDesc->filename );
         lsTheName = (char *)basename( lsBaseName );
         /* do more stuff */
      }
   }
   return 0;
}

它正在做的是枚举附加到二进制文件的所有共享库。这在 AIX 5.3 上编译得很好,但在 AIX 7.1 上我得到以下关于 lstModDesc 的信息:

“modulename.c”,第 2553.30 行:1506-285 (S) 间接运算符不能 a 应用于指向不完整的指针 结构或联合。

我找不到在我的 aix 5.3 机器上定义 shl_get 的位置,也找不到定义 struct shl_descriptor 的位置。我难住了。我什至尝试将带有 -E 标志的预处理输出输出到编译器,但没有成功。我在 /usr/include 中做了一个递归 grep。还有其他地方我应该搜索吗?这些定义在哪里?

【问题讨论】:

    标签: c unix aix


    【解决方案1】:

    您确定 AIX 5.3 上的编译中包含了那部分代码吗?我刚刚用 'site:ibm.com shl_descriptor' 去谷歌搜索,结果恰好找到了一项:

    它指出了带有 WAS(WebSphere Application Server)的 HP-UX 上的问题。有使用&lt;dl.h&gt;(动态加载器)的示例代码,并显示shl_descriptorshl_gethandle()shl_load()

    鉴于在 AIX 中完全没有任何命中并且存在 HP-UX 平台,那么您需要解决的问题略有不同。问题是:

    • 为什么 AIX 5.3 上的条件编译排除了使用 shl_descriptor 的部分,而在 AIX 7.1 上没有排除它。您应该查看 #ifdef 行中围绕该代码的条件,并查看在 AIX 5.3 上用于触发仅 HP 编译的条件。

    【讨论】:

    • 好调用整个函数被 AIX4.3 AIX5.2 和 AIX5.1 的定义排除在它之上,所以它被隐藏了。花了一段时间,但你最终是对的。
    猜你喜欢
    • 2019-05-12
    • 2017-03-16
    • 2011-04-04
    • 2016-02-17
    • 2015-12-17
    • 2010-10-08
    • 2012-08-14
    • 2015-12-28
    • 2013-03-04
    相关资源
    最近更新 更多