Topic
  • 3 replies
  • Latest Post - ‏2013-03-27T13:27:08Z by BruceGlassford
BruceGlassford
BruceGlassford
71 Posts

Pinned topic Native Function & Streams Version - conditional compilation?

‏2013-03-26T20:30:12Z |
Have a native function that does various processing depending on the SPL type. It would be nice to be able to have it handle SPL::XML if it exists, and not error out if it doesn't.

Any macros defined by the compiler I can use for that? #ifdef STREAMS_3... maybe?
  • SystemAdmin
    SystemAdmin
    1245 Posts

    Re: Native Function & Streams Version - conditional compilation?

    ‏2013-03-26T22:27:12Z  
    If you are doing this through code-generation template (cgt), the Perl function getProductVersion returns the product version. Outside of that, I don't think we have a C/C++ macro that can tell you the compiler version directly, but there is a workaround that will help you solve the problem: write a script that finds out the Streams version and passes that information to the compiler when you compile.

    1) Use 'streamtool' (or sc) to get the version number. For example, running 'streamtool version' will output something like:
    Version=3.0.0.0
    ProductName=IBM InfoSphere Streams
    Build=20120926230804
    Architecture=x86_64
    ...

    2) The Streams compiler lets you pass flags to the C++ compiler via --cxx-flags=...
  • BruceGlassford
    BruceGlassford
    71 Posts

    Re: Native Function & Streams Version - conditional compilation?

    ‏2013-03-27T13:27:01Z  
    If you are doing this through code-generation template (cgt), the Perl function getProductVersion returns the product version. Outside of that, I don't think we have a C/C++ macro that can tell you the compiler version directly, but there is a workaround that will help you solve the problem: write a script that finds out the Streams version and passes that information to the compiler when you compile.

    1) Use 'streamtool' (or sc) to get the version number. For example, running 'streamtool version' will output something like:
    Version=3.0.0.0
    ProductName=IBM InfoSphere Streams
    Build=20120926230804
    Architecture=x86_64
    ...

    2) The Streams compiler lets you pass flags to the C++ compiler via --cxx-flags=...
    When in doubt, KISS....

    Since every .h file has a #define in it, what I ended up doing:

    #include <SPL/Runtime/Type/SPLType.h> at the top (need that anyways)
    ...
    #ifdef SPL_RUNTIME_TYPE_XML_H
    // Code dealing with SPL::XML
    #endif
    ...
  • BruceGlassford
    BruceGlassford
    71 Posts

    Re: Native Function &#38; Streams Version - conditional compilation?

    ‏2013-03-27T13:27:08Z  
    If you are doing this through code-generation template (cgt), the Perl function getProductVersion returns the product version. Outside of that, I don't think we have a C/C++ macro that can tell you the compiler version directly, but there is a workaround that will help you solve the problem: write a script that finds out the Streams version and passes that information to the compiler when you compile.

    1) Use 'streamtool' (or sc) to get the version number. For example, running 'streamtool version' will output something like:
    Version=3.0.0.0
    ProductName=IBM InfoSphere Streams
    Build=20120926230804
    Architecture=x86_64
    ...

    2) The Streams compiler lets you pass flags to the C++ compiler via --cxx-flags=...
    When in doubt, KISS....

    Since every .h file has a #define in it, what I ended up doing:

    #include <SPL/Runtime/Type/SPLType.h> at the top (need that anyways)
    ...
    #ifdef SPL_RUNTIME_TYPE_XML_H
    // Code dealing with SPL::XML
    #endif
    ...