I'm not sure, but I think that you have to wire the "param" output of "Call library function" to the cluster which consists of
1. datano - I16
2. type - I16
3. the variable with type depending on the type of union - I8 for cdata, 116 for idata, I32 - for ldata, array of I8 for cdatas, array of I16 for idatas, array of I32 for ldatas.
In other words you must know the type of cluster before calling of this function. May be this type depends on values of other parameters.
I think that you have to organize the case structure in your diagram which calls this function and returns the appropriate cluster depending on other parameters.
Oleg Chutko.