Topic
1 reply Latest Post - ‏2013-01-07T12:07:52Z by SystemAdmin
SystemAdmin
SystemAdmin
549 Posts
ACCEPTED ANSWER

Pinned topic Error launching C++ executale in AIX

‏2012-12-24T16:44:42Z |
Hi All,

I am facing a unique problem as part of our application migration from HP to AIX. The following simulated code produces different results in HP and AIX.

library.C ****

#include <stdio.h>
#include "mylib.h"

int libimgclientFNXXX()
{
int check = 100;
check = FileNetDeleteDoc(check);
return check;
}

int libimgclientFN()
{
int check = 1;
printf("In lib ");
return check;
}

main_func.C ****

#include <stdio.h>

int libimgclientFN();
int libimgclientFNXXX();

int main()
{
int one = 0;
if (1 == 1)
{
one = libimgclientFN();
}
printf("\n The status is %d \n", one);
}

mylib.h *****
extern int FileNetDeleteDoc (int);

Note that the function libimgclientFNXXX() is never called. My make file is as below:

xlC -c -g library.C -o library.o -I./

xlC -G -qmkshrobj -o libImgClient.so library.o

xlC -c -g -qpic=small main_func.C -o main_func.o

xlC -brtl main_func.o -L. -lImgClient -o TST

When I run TST, I get the following loading error

$ TST
exec(): 0509-036 Cannot load program TST because of the following errors:
rtld: 0712-001 Symbol FileNetDeleteDoc__Fi was referenced from module ./libImgClient.so(),
but a runtime definition of the symbol was not found.

Even though the function libimgclientFNXXX() is never called, there is unresolved errors.

The exact same code built in HP works fine with no errors.

Any inputs is appreciated.

Thanks,
Updated on 2013-01-07T12:07:52Z at 2013-01-07T12:07:52Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    549 Posts
    ACCEPTED ANSWER

    Re: Error launching C++ executale in AIX

    ‏2013-01-07T12:07:52Z  in response to SystemAdmin
    1. You did not use optimization, thus, dead code elimination is not on. So, every mentioned function shall be resolved somehow.
    2. The weird name gives a hint: C++ mangling.
    In mylib.h file, replace:
    extern int FileNetDeleteDoc (int);
    with:
    extern
    #ifdef __cplusplus
    "C"
    #endif
    int FileNetDeleteDoc (int);