You can also try using FreeUDFlib for windows (made in Delphi, get the source code which is an excellent reference). There is a port to Linux (by Rob Schieck), but is limited to dialect 1 and 60 functions. Another one is FreeUDFLibC (by …
More here:
Firebird News » Compiling Linux UDFs on MSVC++