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";
}
Code: Select all
/usr/vacpp/bin/xlC_r -O -q64 -c libpadcharPX.cpp
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
Could some one please correct me if extra steps are to be followed while building a shared library.
Thanks