Page 1 of 1
DS routine orchestrate.h
Posted: Thu Dec 08, 2016 7:47 am
by Childrensmn
Trying to figure out how to get this function to return a integer. Im no c++ programmer and Im not sure how to get this to work... Any help would be appreciated.
The only thing I need is to pass in a string (from DS) and Apt_hash to return the integer back to ds.
Code: Select all
#include <apt_framework/orchestrate.h>
int* ObjTestOne(char Arg1 )
{
int* OutInt;
OutInt = APT_hash(char Arg1 );
return OutInt;
}
Posted: Thu Dec 08, 2016 12:26 pm
by UCDI
Code: Select all
int ObjTestOne(char Arg1 )
{
int* OutInt;
OutInt = APT_hash(char Arg1 );
int returnme = OutInt[0];
return returnme;
}
I haven't had time to study ds parallism in detail so I have been erring on the side of caution and setting up a tiny memory manager in my functions. I think the above is safe but validate it carefully to ensure that there are no thread-safety type issues. Can anyone elaborate on if datastage does any sort of protectionism and thread safety wrappers to these function calls?
Re: DS routine orchestrate.h
Posted: Thu Dec 08, 2016 12:26 pm
by Childrensmn
I did get the code to compile however when I run this routine in a job I get the following error.
"Transformer_0: Error when checking composite operator: Failed to load the library "V0S0_cpp_test_routine_2_Transformer_0.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 "V0S0_cpp_test_routine_2_Transformer_0": /projects/DwTest/RT_BP930.O/V0S0_cpp_test_routine_2_Transformer_0.so: undefined symbol: _Z10ObjTestOnea. "
I should add the compile line and lib path
g++ -c rr_temp.cpp -O -fPIC -Wno-deprecated -m64 -mtune=generic -mcmodel=small -shared -m64 -I /app/IBM/InformationServer/Server/PXEngine/include
vmpdwis1</app/IBM/InformationServer/Server/PXEngine/lib>
LD_LIBRARY_PATH=`dirname $DSHOME`/biginsights/IHC/c++/Linux-amd64-64/lib:`dirname $DSHOME`/bran
ded_odbc/lib:`dirname $DSHOME`/DSComponents/lib:`dirname $DSHOME`/DSComponents/bin:$DSHOME/lib:$DSHOME/
uvdlls:`dirname $DSHOME`/PXEngine/lib:$ISHOME/jdk/jre/lib/amd64/j9vm:$ISHOME/jdk/jre/lib/amd64:$ASBHOME
/lib/cpp:$ASBHOME/apps/proxy/cpp/linux-all-x86_64:$NZ_HOME/lib64:$ORACLE_HOME/lib:$ORACLE_HOME/sqlplus/
lib:/app/IBM/InformationServer/Server/PXEngine/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
Posted: Thu Dec 08, 2016 12:31 pm
by UCDI
You are returning a POINTER not a VALUE. I fixed it for you above.
Also, there are specific compiler options to make a library that DS can call.
g++ -O -fPIC -Wno-deprecated -m64 -mtune=generic -mcmodel=small -shared -m64 -c $1
where $1 is your source file.
you might need more if you have multiple files, this is to compile a simple monolithic source file. Make is beyond me, Im a visual studio kind of guy...
yours is similar but slightly different from mine. It could be something in those differences? I can try to help -- I am very good at realtime C++ but am only low-moderate at unix.