Issue with shared library parallel routine

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
zulfi123786
Premium Member
Premium Member
Posts: 730
Joined: Tue Nov 04, 2008 10:14 am
Location: Bangalore

Issue with shared library parallel routine

Post by zulfi123786 »

Hi,

Below is the steps i am following to build a shared library parallel routine.

1. Created libpadcharPX.cpp code as below

Code: Select all

#include<iostream.h>
#include<string>
#include<string.h>

using namespace std;

char *PadcharPX(char *str,char *padchr,int lenstr,char *align){
int i;
char *padstr;
string str1;
if (strlen(str) >= lenstr)
return str;
i=lenstr-strlen(str);
str1.assign(i,*padchr);
padstr = new char [lenstr+1];
strcpy(padstr,str1.c_str());
if (*align == 'L')
{
strcat(str,padstr);
return str;
}
else if(*align == 'R')
{
strcat(padstr,str);
return padstr;
}
else return "INVALID JUSTIFICATION";
}
2. Created object file using below command

Code: Select all

/usr/vacpp/bin/xlC_r -O -q64 -c libpadcharPX.cpp
APT_COMPILER=/usr/vacpp/bin/xlC_r
APT_COMPILEOPT=-O -q64 -c
APT_LINKER=/usr/vacpp/bin/xlC_r
APT_LINKEOPT=-G -q64

3. Built the shared library *.so using the below command

Code: Select all

/usr/vacpp/bin/xlc -G -q64 -o /home_dir/a534227/libNewpadcharPX.so /home_dir/a534227/libNewpadcharPX.o
The job runs but is giving incorrect results. The same code and object file when used with parallel routine with "object" File returns correct results.

Could some one please correct me if extra steps are to be followed while building a shared library.

Thanks
- Zulfi
Post Reply