[m-rev.] diff: use a different library name for the ODBC binding

Julien Fischer jfischer at opturion.com
Mon Jan 17 14:11:42 AEDT 2022


Use a different library name for the ODBC binding.

When building the ODBC binding as a library, name it libmercury_odbc, rather
than libodbc; unixODBC uses the former name, which is at the very least
confusing and appears to the source of linker errors on some platforms.

extras/odbc/mercury_odbc.m:
     An empty module importing odbc, that is used to force the library
     name to be libmercury_odbc instead of libodbc.

extras/odbc/Mmakefile:
     Do not warn about the module we use force the library name not exporting
     anything.

     Delete a workaround for really old versions of GCC.

Julien.

diff --git a/extras/odbc/Mmakefile b/extras/odbc/Mmakefile
index d51168d..ce37841 100644
--- a/extras/odbc/Mmakefile
+++ b/extras/odbc/Mmakefile
@@ -31,6 +31,9 @@ INSTALL_PREFIX := $(INSTALL_PREFIX)/extras

  -include ../Mmake.params

+# Do not issue a warning because mercury_odbc does not export anything.
+MCFLAGS-mercury_odbc = --no-warn-nothing-exported --no-warn-interface-imports
+
  #-----------------------------------------------------------------------------#

  ifeq ($(MODBC_DRIVER),MODBC_MS)
@@ -61,10 +64,7 @@ check:

  #-----------------------------------------------------------------------------#

-# `--no-ansi' is needed because the ODBC header files include C++-style
-# "//" comments.  `--no-ansi' allows recognition of C++-style "//" comments,
-# presuming you have gcc version 2.7.1 or greater.
-MGNUCFLAGS=--no-ansi -D$(MODBC_DRIVER) -D$(MODBC_DB) -I$(ODBC_INCL_DIR)
+MGNUCFLAGS=-D$(MODBC_DRIVER) -D$(MODBC_DB) -I$(ODBC_INCL_DIR)

  #-----------------------------------------------------------------------------#
  #-----------------------------------------------------------------------------#
diff --git a/extras/odbc/mercury_odbc.m b/extras/odbc/mercury_odbc.m
index e69de29..18fc77a 100644
--- a/extras/odbc/mercury_odbc.m
+++ b/extras/odbc/mercury_odbc.m
@@ -0,0 +1,12 @@
+%-----------------------------------------------------------------------------%
+% Copyright (C) 2022 The Mercury team.
+% This file is distributed under the terms specified in COPYING.LIB.
+%-----------------------------------------------------------------------------%
+%-----------------------------------------------------------------------------%
+
+% mercury_odbc -- a Mercury ODBC library.
+
+:- module mercury_odbc.
+:- interface.
+
+:- import_module odbc.


More information about the reviews mailing list