Don't know how to pass a pointer of structure to C function
Posted: Thu May 15, 2014 3:49 pm
Today, I try to call MongoDB C Driver API in newLISP code.
Below is this C function declaration :
I have got database pointer successfully before, but do not know how to pass a pointer as bson_error_t, bson_error_t is a struct in C defined like so:
My newlisp code snippets:
I called the above function in another file, but got error:
Below is this C function declaration :
Code: Select all
char **
mongoc_database_get_collection_names (mongoc_database_t *database,
bson_error_t *error);
Code: Select all
typedef struct
{
uint32_t domain;
uint32_t code;
char message[504];
} bson_error_t;
Code: Select all
(import library "mongoc_database_get_collection_names" "void*" "void*" "void*")
(define (get_coll_names s e)
(mongoc_database_get_collection_names s e))
Code: Select all
(Mongo:get_coll_names s e)
ERR: value expected : nil
called from user defined function Mongo:get_coll_names