[UDF系列]如何编写InterBase UDF 之三
来源:互联网 发布:mac os sierra10.12.6 编辑:程序博客网 时间:2024/05/16 06:45
(接上一篇)
如何编写InterBase UDF
warton译
(前面讲了在windows下编写UDF)
编写Linux/Unix平台的UDF
(译者注:原用大量篇幅讲述了linux下的SO(shared object)文件和windows下的DLL文件,其实它们都是一种动态链接库,在此不做详细翻译!)
怎么在Linux 下生成一个shared library(共享库)?
1.建立一个C文件(扩展名为.c)
2.建立模块函数: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;
}
编译和使用它
在命令行下:
gcc -c -O -fpic -fwritable-strings <your udf>.c
ld -G <your udf>.o -lm -lc -o <your udflib>.so
cp <your udflib>.so /usr/interbase/udf
然后在ISQL中:
declare 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;
真是太简单了!!
结论:
看来编写UDF真的不难!看,它包含的内容也不太多!毕竟Linux开发者也不为难了。
最后:
如果你想要更好的编程例子,可以下载FreeUDFLib—一个Delphi的UDF库和一个FreeUDFLibC―一个基于C的UDF库,它可以运行在Solaris,Linux,Windows等
(注,由于原本少量内容与主题无关,本人没有翻译)
- [UDF系列]如何编写InterBase UDF 之三
- [UDF系列]如何编写InterBase UDF 之三
- [UDF系列]如何编写InterBase UDF 之一
- [UDF系列]如何编写InterBase UDF
- [UDF系列]如何编写InterBase UDF 之二
- [UDF系列]如何创建InterBase UDF
- MySQL:如何编写UDF
- MySQL:如何编写UDF
- udf 编写
- Write Udf For Interbase/Firebird
- hive中如何自定义编写UDF函数
- Interbase/Firebird Date&Time Function For UDF
- Hives UDF 编写入门
- hive UDF编写
- pig的udf编写
- Hive编写UDF函数
- SparkSQL使用之如何使用UDF
- 玩转大数据系列之Apache Pig如何通过自定义UDF查询数据库(五)
- 开源的Stunnel--通用SSL加密程序
- 在Java2环境中应用IP地址封装对象
- MySQL索引分析和优化
- [UDF系列]如何编写InterBase UDF 之一
- [UDF系列]如何编写InterBase UDF 之二
- [UDF系列]如何编写InterBase UDF 之三
- [UDF系列]如何创建InterBase UDF
- 传递和返回数据到一个Delphi编写的UDF
- 用C++Builder 6编写VCL控件
- Borland C++ Mobile Edition为手机开发保驾护航!
- [C++Builder/Delphi初学者指南] 用C++Builder、Delphi转换数据表
- 优秀的开源C++库:ACE及其安装使用
- C#Builder初体验
- 软件试用期及试用次数控制(附部分关键代码)!