(Connected to the previous one)
How to write Interbase UDF
Warton translation
(Tell the UDF under Windows)
Write the UDF of the Linux / UNIX platform
(Translator Note: The original large amount of space tells the SO (Shared Object) files under Linux and the DLL file under Windows. In fact, they are all dynamic link libraries, don't make detailed translation here!)
How to generate a shared library under Linux?
1. Create a C file (extension is .c)
2. Establish a module function: int modulo (int *, int *);
Int modulo (a, b)
INT * a;
INT * B;
{
IF (* b == 0)
Return -1; // Return Something suitably stupid.
Else
Return * a% * b;
}
Compile and use it
On the command line:
GCC-CO-FPIC-FWRITABLE-STRINGS
LD -G
CP
Then in ISQL:
DECLE EXTERNAL FUNCTION F_MODULO
INTEGER, INTEGER
Returns
INTEGER by value
Entry_Point 'MODULO' MODULE_NAME 'Name of Shared Library';
COMMIT;
SELECT F_MODULO (3, 2) from RDB $ Database;
It's too simple!!
in conclusion:
It seems that it is really not difficult to write UDF! Look, there is not much content it contains! After all, Linux developers are not difficult.
At last:
If you want a better programming example, you can download freeudflib-a Delphi UDF library and a Freeudflibc-a C-based UDF library, which can run in Solaris, Linux, Windows, etc.
(Note, because the original small amount is not related to the subject, I have no translation)