Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extern table_funcs not visible from Windows DLL for extensions like vaults (crashes) #3951

monetdb-team opened this issue Nov 30, 2020 · 0 comments


Copy link

@monetdb-team monetdb-team commented Nov 30, 2020

Date: 2016-03-12 02:00:08 +0100
From: Clint Cummins <>
To: SQL devs <>
Version: 11.21.13 (Jul2015-SP2)
CC: @njnes

Last updated: 2016-03-25 09:59:28 +0100

Comment 21877

Date: 2016-03-12 02:00:08 +0100
From: Clint Cummins <>

User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36
Build Identifier:

User added functions like vaults/fits do not work on Windows,
because externs like table_funcs are not visible to a Windows DLL.
(Although they run fine on Linux).
This causes a crash when one of these functions is called,
because the address of table_funcs and table_funcs.function_name is 0 in the DLL which holds the extensions code.
Changing 3 lines in sql/storage/store.c and sql/storage/sql_storage.h fixes
the problem on Windows:
table_functions table_funcs; --> __declspec(dllexport) table_functions table_funcs;
and similar for store_funcs and logger_funcs.
extern table_functions table_funcs; --> extern __declspec(dllimport) table_functions table_funcs;
and similar for store_funcs and logger_funcs.
I have only tested this on Windows, not on Linux.
Apparently a macro __declspec(x) is defined near the end of monetdb_config.h which should make the above changes also be fine on Linux, though.

Reproducible: Always

Steps to Reproduce:

  1. On Windows, build MonetDB-11.21.13 with an extension like sql/backends/monet5/vaults/fits.c
    (my particular extension is based on this one; it accesses a different file format)
  2. call the SQL function which runs the extension
  3. it crashes at the first call to a function in table_funcs, such as
    If you print the address of this function in the DLL, it is 0.

Actual Results:


Expected Results:

Run the table_funcs and store_funcs functions normally.

None needed, since I included the fix in the Details section.

Comment 21921

Date: 2016-03-16 16:42:18 +0100
From: MonetDB Mercurial Repository <>

Changeset eee653606690 made by Sjoerd Mullender in the MonetDB repo, refers to this bug.

For complete details, see http//devmonetdborg/hg/MonetDB?cmd=changeset;node=eee653606690

Changeset description:

Export table_funcs, store_funcs, and logger_funcs variables.
This is a stop gap solution to the problem that the data vaults don't
work on Windows.
This should fix bug #3951.

Comment 21923

Date: 2016-03-16 18:23:05 +0100
From: @njnes

the exports have been added

Comment 21967

Date: 2016-03-25 09:59:28 +0100
From: @sjoerdmullender

Jul2015-SP3 has been released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant