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

Swig fixes #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions lmdb-php.i
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%module example
%module lmdb
%include exception.i

%{
Expand Down Expand Up @@ -39,7 +39,9 @@
%newobject mdb_env_stat_swig;
%newobject mdb_set_relctx_swig;
%newobject mdb_stat_swig;
#if MDB_VERSION_PATCH > 10
%newobject mdb_env_set_userctx_swig;
#endif
%newobject mdb_env_get_fd_swig;


Expand All @@ -52,7 +54,9 @@
%rename (mdb_env_get_fd) mdb_env_get_fd_swig(MDB_env *env);
%rename (mdb_env_get_path) mdb_env_get_path_swig(MDB_env *env);
%rename (mdb_env_get_flags) mdb_env_get_flags_swig(MDB_env *env);
#if MDB_VERSION_PATCH > 10
%rename (mdb_env_set_userctx) mdb_env_set_userctx_swig(MDB_env *env, char *value);
#endif
%rename (mdb_dbi_flags) mdb_dbi_flags_swig(MDB_txn *txn, MDB_dbi dbi);
%rename (mdb_cursor_count) mdb_cursor_count_swig(MDB_cursor *cursor);
%rename (mdb_reader_check) mdb_reader_check_swig(MDB_env *env);
Expand Down Expand Up @@ -147,7 +151,9 @@

return flags;
}

%}
#if MDB_VERSION_PATCH > 10
%inline %{
int mdb_env_set_userctx_swig(MDB_env *env, char *value){
int length = strlen(value);
char *res = malloc(length);
Expand All @@ -164,7 +170,9 @@

return (char *)pointer;
}

%}
#endif
%inline %{
int mdb_env_get_flags_swig(MDB_env *env){
unsigned int flags;

Expand Down
Loading