代码在 AIX 5.3 上编译,但在 AIX 7.1 上编译,这与 struct shl_descriptor 有关,这是在哪里定义的?

标签 c unix aix

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

#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", line 2553.30: 1506-285 (S) The indirection operator cannot be a pplied to a pointer to an incomplete struct or union.

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

最佳答案

您确定那部分代码包含在 AIX 5.3 上的编译中吗?我刚刚使用“site:ibm.com shl_descriptor”进行了谷歌搜索,正好找到了一项:

它指出 HP-UX 与 WAS (WebSphere Application Server) 存在问题。有使用 <dl.h> 的示例代码(动态加载程序),并显示 shl_descriptorshl_gethandle()shl_load() .

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

  • 为什么 AIX 5.3 上的条件编译不包括使用 shl_descriptor 的部分?并且不在 AIX 7.1 上排除它。您应该查看 #ifdef 中围绕该代码的条件行,并查看用于触发 AIX 5.3 上仅 HP 编译的内容。

关于代码在 AIX 5.3 上编译,但在 AIX 7.1 上编译,这与 struct shl_descriptor 有关,这是在哪里定义的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4247220/

相关文章:

php - 如何处理 IBM i Pase(特别是 PHP Composer)中的密码提示

c - 如何在 gtk 中运行该程序而不崩溃?

c - 如何将相同的变量添加到自身?

c - 链接到外部 C 库的 R 包

shell - 为找到的每个 .txt 文件创建单独的 zip 文件并在之后移动它们的脚本

powershell中等效的unix退出命令?

AIX 上的 sed 无法识别 -i 标志

python - aix 6.1 : python: ImportError: No module named _md5

c - 如何为 SPOJ AIBOHP 优化空间

linux - Grep 问题 : Why is grep -i not grabbing the instance with special characters