Typedefs | Functions
dl.c File Reference
#include <stdbool.h>
#include <stdint.h>
#include <uv.h>
#include "nvim/os/os.h"
#include "nvim/memory.h"
#include "nvim/message.h"

Typedefs

typedef void(* gen_fn) (void)
 Functions for using external native libraries. More...
 
typedef const char *(* str_str_fn) (const char *str)
 
typedef int64_t(* str_int_fn) (const char *str)
 
typedef const char *(* int_str_fn) (int64_t i)
 
typedef int64_t(* int_int_fn) (int64_t i)
 

Functions

bool os_libcall (const char *libname, const char *funcname, const char *argv, int64_t argi, char **str_out, int64_t *int_out)
 

Typedef Documentation

typedef void(* gen_fn) (void)

Functions for using external native libraries.

possible function prototypes that can be called by os_libcall() int -> int int -> string string -> string string -> int

typedef int64_t(* int_int_fn) (int64_t i)
typedef const char*(* int_str_fn) (int64_t i)
typedef int64_t(* str_int_fn) (const char *str)
typedef const char*(* str_str_fn) (const char *str)

Function Documentation

bool os_libcall ( const char *  libname,
const char *  funcname,
const char *  argv,
int64_t  argi,
char **  str_out,
int64_t *  int_out 
)

os_libcall - call a function in a dynamic loadable library

an example of calling a function that takes a string and returns an int:

int64_t int_out = 0; os_libcall("mylib.so", "somefn", "string-argument", 0, NULL, &int_out);

Parameters
libnamethe name of the library to load (e.g.: libsomething.so)
funcnamethe name of the library function (e.g.: myfunc)
argvthe input string, NULL when using argi
argithe input integer, not used when using argv != NULL
[out]str_outan allocated output string, caller must free if not NULL. NULL when using int_out.
[out]int_outthe output integer param
Returns
true on success, false on failure