I assume you mean the source code, because without the object code the database can’t execute the UDF. You can create the UDF by supplying only the compatible object or linked library (dll/so). In the case of the linked library you would have to place that on every node in a designated directory manually. Objects can be supplied via the CREATE statement. The EXTERNAL clause would have to specify what directory to get them from on the client. That only works through BTEQ or a CLI application. If you use ODBC then you have to put the objects on the server on the software distribution node and the CREATE can pick them up from there.
The UDFs are actually stored in the DB nodes (TPA), it's irrelevant whether you access the from a client in the Windows/Unix or mainframe.
UDFs can be written in C/C++ ... when you submit the code to TD through bteq, it internally transfers the source files to one of the PE nodes where a compiler is installed, where it's compiled and made into an object code which is distributed to all the DB nodes (TPA).
So irrespective of which platform you submitted your source code from, it would be compiled in the destination platform (TD's) and the object code would be generated in that platform.
Once the UDF is compiled in, you can access it from any client in any platform.
Some times you need to install third party UDFs etc which has only binaries and no source, in that case the binaries should be compatible with TD's platform.