Migrate UDXs from API version 1 to API version 2

If you have UDXs that use UDX version 1 and the nz::udx namespace, those UDXs will continue to run following an upgrade to release 6.0 or later. If you want to migrate your UDXs to version 2 to take advantage of features such as the new version 2 API methods, environment access, or others, there are a few small changes that must be made to the C++ source code files:

  • Change the namespace from nz::udx to nz::udx_ver2.
  • The constructor and instantiator for a UDX must be revised to take a UdxInit object.
    For example, in API version 1, an UDX can have the following form:
       using namespace nz::udx;
    class CCustomerName: public Udf
    {
    public:
         static Udf* instantiate();
    };
    Udf* CCustomerName::instantiate()
    {
         return new CCustomerName;
    }
    In API version 2, the instantiator and constructor take a UdxInit argument. As a result, you must declare the constructor, even if it does not take any arguments, as in this example:
       using namespace nz::udx_ver2;
    class CCustomerName: public nz::udx_ver2::Udf
    {
    public:
         CCustomerName(UdxInit *pInit) : Udf(pInit){}
         static nz::udx_ver2::Udf* instantiate(UdxInit *pInit);
    };
    
    nz::udx_ver2::Udf* CCustomerName::instantiate(UdxInit *pInit)
    {
         return new CCustomerName(pInit);
    }