Rizin
unix-like reverse engineering framework and cli tools
main.c File Reference
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <uv.h>
#include "plugin.h"

Go to the source code of this file.

Typedefs

typedef void(* init_plugin_function) ()
 

Functions

void mfp_register (const char *name)
 
int main (int argc, char **argv)
 

Typedef Documentation

◆ init_plugin_function

typedef void(* init_plugin_function) ()

Definition at line 9 of file main.c.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 15 of file main.c.

15  {
16  if (argc == 1) {
17  fprintf(stderr, "Usage: %s [plugin1] [plugin2] ...\n", argv[0]);
18  return 0;
19  }
20 
21  uv_lib_t *lib = (uv_lib_t*) malloc(sizeof(uv_lib_t));
22  while (--argc) {
23  fprintf(stderr, "Loading %s\n", argv[argc]);
24  if (uv_dlopen(argv[argc], lib)) {
25  fprintf(stderr, "Error: %s\n", uv_dlerror(lib));
26  continue;
27  }
28 
29  init_plugin_function init_plugin;
30  if (uv_dlsym(lib, "initialize", (void **) &init_plugin)) {
31  fprintf(stderr, "dlsym error: %s\n", uv_dlerror(lib));
32  continue;
33  }
34 
35  init_plugin();
36  }
37 
38  return 0;
39 }
void * malloc(size_t size)
Definition: malloc.c:123
static static fork const void static count static fd const char const char static newpath char char argv
Definition: sflib.h:40
Definition: unix.h:218
void(* init_plugin_function)()
Definition: main.c:9
UV_EXTERN int uv_dlopen(const char *filename, uv_lib_t *lib)
Definition: dl.c:33
UV_EXTERN int uv_dlsym(uv_lib_t *lib, const char *name, void **ptr)
Definition: dl.c:53
UV_EXTERN const char * uv_dlerror(const uv_lib_t *lib)
Definition: dl.c:60

References argv, malloc(), uv_dlerror(), uv_dlopen(), and uv_dlsym().

◆ mfp_register()

void mfp_register ( const char *  name)

Definition at line 11 of file main.c.

11  {
12  fprintf(stderr, "Registered plugin \"%s\"\n", name);
13 }
Definition: z80asm.h:102

Referenced by initialize().