Sha256: 9063f1a056cded879412b3c08308bfce42deb4a2c4f7a54a8725656b09eaa526

Contents?: true

Size: 913 Bytes

Versions: 15

Compression:

Stored size: 913 Bytes

Contents

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include <uv.h>

#include "plugin.h"

typedef void (*init_plugin_function)();

void mfp_register(const char *name) {
    fprintf(stderr, "Registered plugin \"%s\"\n", name);
}

int main(int argc, char **argv) {
    if (argc == 1) {
        fprintf(stderr, "Usage: %s [plugin1] [plugin2] ...\n", argv[0]);
        return 0;
    }

    uv_lib_t *lib = (uv_lib_t*) malloc(sizeof(uv_lib_t));
    while (--argc) {
        fprintf(stderr, "Loading %s\n", argv[argc]);
        if (uv_dlopen(argv[argc], lib)) {
            fprintf(stderr, "Error: %s\n", uv_dlerror(lib));
            continue;
        }

        init_plugin_function init_plugin;
        if (uv_dlsym(lib, "initialize", (void **) &init_plugin)) {
            fprintf(stderr, "dlsym error: %s\n", uv_dlerror(lib));
            continue;
        }

        init_plugin();
    }

    return 0;
}

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
mt-libuv-4.1.04 ext/libuv/docs/code/plugin/main.c
mt-libuv-4.1.03 ext/libuv/docs/code/plugin/main.c
mt-libuv-4.1.02 ext/libuv/docs/code/plugin/main.c
libuv-4.0.9 ext/libuv/docs/code/plugin/main.c
libuv-4.0.2 ext/libuv/docs/code/plugin/main.c
libuv-4.0.1 ext/libuv/docs/code/plugin/main.c
libuv-4.0.0 ext/libuv/docs/code/plugin/main.c
libuv-3.3.0 ext/libuv/docs/code/plugin/main.c
libuv-3.2.4 ext/libuv/docs/code/plugin/main.c
libuv-3.2.3 ext/libuv/docs/code/plugin/main.c
libuv-3.2.2 ext/libuv/docs/code/plugin/main.c
libuv-3.2.1 ext/libuv/docs/code/plugin/main.c
libuv-3.2.0 ext/libuv/docs/code/plugin/main.c
libuv-3.1.9 ext/libuv/docs/code/plugin/main.c
libuv-3.1.8 ext/libuv/docs/code/plugin/main.c