Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- C part :
- mongo_connection_options * make_mongo_connection_options( char host[255], int port ){
- mongo_connection_options *opts = malloc(sizeof(mongo_connection_options));
- strcpy( opts->host , host );
- opts->port = port;
- return opts;
- }
- Perl6 part:
- use NativeCall;
- sub mongo_connect( OpaquePointer $client, OpaquePointer $options)
- returns OpaquePointer
- is native('libmongoc')
- { ... }
- sub make_mongo_connection_options( Str $host, Int $port )
- returns OpaquePointer
- is native('libmongoc')
- { ... }
- my OpaquePointer $connection;
- my $options = make_mongo_connection_options('localhost', 27017);
- my $answer = mongo_connect($connection,$options);
- 'done'.say;
- The problem is $options becomes a UnManagedStruct , and passing it to mongo_connect does not work ( no connection, silent fail )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement