From 1eb11537a5aa2aa75ebb9d03279a9e1eab4dfce0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?= <grubba@grubba.org> Date: Thu, 12 Nov 2009 16:10:21 +0100 Subject: [PATCH] Added get_sql_null() to be able to support dynamic linking on WIN32. Rev: src/builtin.cmod:1.240 Rev: src/builtin_functions.h:1.40 Rev: src/modules/Mysql/result.c:1.52 Rev: src/modules/Oracle/oracle.c:1.100 --- src/builtin.cmod | 10 ++++++++-- src/builtin_functions.h | 5 ++--- src/modules/Mysql/result.c | 4 ++-- src/modules/Oracle/oracle.c | 4 ++-- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/builtin.cmod b/src/builtin.cmod index afe9bfdcc4..2b1f8dc3c1 100644 --- a/src/builtin.cmod +++ b/src/builtin.cmod @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: builtin.cmod,v 1.239 2009/11/11 14:05:58 grubba Exp $ +|| $Id: builtin.cmod,v 1.240 2009/11/12 15:10:21 grubba Exp $ */ #include "global.h" @@ -4156,7 +4156,13 @@ PIKECLASS MasterCodec /*! @endmodule */ -struct object *SqlNULL_object; +static struct object *SqlNULL_object; + +/* Proxy function needed for dynamic linkage on WIN32. */ +PMOD_EXPORT struct object *get_sql_null(void) +{ + return SqlNULL_object; +} void init_builtin(void) { diff --git a/src/builtin_functions.h b/src/builtin_functions.h index a87cce070a..36ef712705 100644 --- a/src/builtin_functions.h +++ b/src/builtin_functions.h @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: builtin_functions.h,v 1.39 2009/11/11 12:53:49 grubba Exp $ +|| $Id: builtin_functions.h,v 1.40 2009/11/12 15:10:21 grubba Exp $ */ #ifndef BUILTIN_EFUNS_H @@ -46,8 +46,7 @@ struct replace_many_context int flags; }; -extern struct object *SqlNULL_object; -extern struct program *SqlNull_program; +PMOD_EXPORT struct object *get_sql_null(void); PMOD_EXPORT void f_equal(INT32 args); PMOD_EXPORT void f_hash(INT32 args); diff --git a/src/modules/Mysql/result.c b/src/modules/Mysql/result.c index 693111551e..5a277d9cbd 100644 --- a/src/modules/Mysql/result.c +++ b/src/modules/Mysql/result.c @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: result.c,v 1.51 2009/11/11 13:10:50 grubba Exp $ +|| $Id: result.c,v 1.52 2009/11/12 15:10:21 grubba Exp $ */ /* @@ -627,7 +627,7 @@ static void f_fetch_row(INT32 args) } else { /* NULL */ if (PIKE_MYSQL_RES->typed_mode) { - ref_push_object(SqlNULL_object); + ref_push_object(get_sql_null()); } else { push_undefined(); } diff --git a/src/modules/Oracle/oracle.c b/src/modules/Oracle/oracle.c index a97282dd5f..41a02bee50 100644 --- a/src/modules/Oracle/oracle.c +++ b/src/modules/Oracle/oracle.c @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: oracle.c,v 1.99 2009/11/09 14:34:02 grubba Exp $ +|| $Id: oracle.c,v 1.100 2009/11/12 15:10:21 grubba Exp $ */ /* @@ -2728,7 +2728,7 @@ PIKE_MODULE_INIT MY_START_CLASS(dbnull); { struct pike_string *null_string = make_shared_string("Null"); - low_inherit(SqlNull_program, NULL, -1, 0, 0, null_string); + low_inherit(get_sql_null()->prog, NULL, -1, 0, 0, null_string); free_string(null_string); add_integer_constant("is_oracle_null", 1, 0); ADD_FUNCTION("create", dbnull_create, tFunc(tOr(tStr, tInt), tVoid), -- GitLab