I am trying to convert names to camel case. I am trying to implement using the c++ code I found on this site (shown below). but when I am calling it from the parallel routine I am getting the below error. Can you please let me know what is the error meaning. I am pretty sure that it is able to find the routine because I have already tried a function that returns integer and its working fine. Just for your information I have used the options defined in the environment variables to compile and create shared objects using g++ compiler.
Transformer_13: Failed to load the library "V0S13_casetester_Transformer_13.so"; either the directory containing the library file
is not on the library search path, or the library was compiled on a system
that is incompatible with this system: Could not load "V0S13_casetester_Transformer_13": /opt/IBM/InformationServer/Server/Projects/PJ/RT_BP469.O/V0S13_casetester_Transformer_13.so: undefined symbol: _Z7ConvMCTi.
#include "stdio.h"
#include "string.h"
#include "stdlib.h"
#include "ctype.h"
char* ConvMCT(char *str) //Function with string input and string
{
char *result = new char[sizeof(str)*sizeof(char *)];
int x=0, Flag=1; // Setting Flag to 1 to make the first letter capital.
char CheckStr[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
while(*str)
{
if(Flag=1) //Check if the last character was not alphabet.
{
if(isalpha(*str) and islower(*str)) //Convert to uppercase if its a lower case alphabet.
{
result[x] = toupper(*str);
}
else
{
result[x] = *str; //No Change if its already in uppercase or not an alphabet.
}
}
else
{
if(isalpha(*str) and isupper(*str))
{
result[x] = tolower(*str); //Convert to lowercase except the first character.
}
else
{
result[x] = *str;
}
}
if(!strchr(CheckStr, *str)) //Check if the string is not a-z and A-Z.
{
Flag=1;
}
else
{
Flag =0;
}
++x;
++str;
}
result[x] = '\0'; //Terminate the string
return result; //Return the replaced string
}
further to my previous post I understand that the issue is with the parameter definition of char * which is causing the trouble. Is there an alternate way of implementing this?
What 'same issue' - the exact same error calling the exact same parallel routine? If not, you need to start your own post with the gory details of your own particular problem.
-craig
"You can never have too many knives" -- Logan Nine Fingers
What was the operating system you compiled on ? Linux ? Otherwise g++ is NOT the optimizing compiler for your platform for datastage parallel transformer. what is the default value of APT_COMPILER on your environment?
for HP-UX -> use aC++ compiler
for IBM-AIX -> use xlC/C++ compiler
for Solaris -> use Sun/Oracle workshop compiler ( cc )
Linux : g++
I dont think any other *Nix platform is currently supported.
The code in the OP contains a memory leak. It is allocating memory with the new operator, and that memory never gets freed. How to fix this? Sorry, not possible. At present it is impossible to write string functions that do not have memory leaks or thread safety issues. IBM should implement a parallel routine type that receives and returns a std::string object, as this is precisely what the string class was invented for.