apps
core
deps
base64c
codemirror
crypt_blowfish
libbacktrace
libbacktrace_config
libsodium
libuv
.github
docs
code
cgi
default-loop
detach
dns
helloworld
idle-basic
idle-compute
interfaces
locks
multi-echo-server
onchange
pipe-echo-server
plugin
hello.c
main.c
plugin.h
proc-streams
progress
queue-cancel
queue-work
ref-timer
signal
spawn
tcp-echo-server
thread-create
tty
tty-gravity
udp-dhcp
uvcat
uvstop
uvtee
uvwget
.gitignore
CMakeLists.txt
Makefile
src
Makefile
make.bat
requirements.txt
img
include
m4
src
test
tools
.gitattributes
.gitignore
.mailmap
.readthedocs.yaml
AUTHORS
CMakeLists.txt
CONTRIBUTING.md
ChangeLog
LICENSE
LICENSE-docs
LINKS.md
MAINTAINERS.md
Makefile.am
README.md
SUPPORTED_PLATFORMS.md
autogen.sh
configure.ac
libuv-static.pc.in
libuv.pc.in
uv_win_longpath.manifest
quickjs
smoothie
speedscope
split
sqlite
valgrind
xopt
docs
src
tools
.dockerignore
Dockerfile
LICENSE
Makefile
README.md
40 lines
913 B
C
40 lines
913 B
C
|
#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;
|
||
|
}
|