/* -*- Mode: C; tab-width: 4; -*- */ /* * Copyright (C) 2009, HustMoon Studio * * 文件名称:dlfunc.c * 摘 要:动态载入库函数 * 作 者:HustMoon@BYHH * 邮 箱:www.ehust@gmail.com * 日 期:2009.11.11 */ #include "dlfunc.h" #ifndef NO_DYLOAD #include int (*pcap_findalldevs)(pcap_if_t **, char *); void (*pcap_freealldevs)(pcap_if_t *); pcap_t *(*pcap_open_live)(const char *, int, int, int, char *); int (*pcap_compile)(pcap_t *, struct bpf_program *, const char *, int, bpf_u_int32); int (*pcap_setfilter)(pcap_t *, struct bpf_program *); char *(*pcap_geterr)(pcap_t *); void (*pcap_freecode)(struct bpf_program *); int (*pcap_loop)(pcap_t *, int, pcap_handler, unsigned char *); void (*pcap_close)(pcap_t *); void (*pcap_breakloop)(pcap_t *); int (*pcap_sendpacket)(pcap_t *, const unsigned char *, int); static void *libpcap = NULL; int load_libpcap(void) { char *error; #ifdef MAC_OS char *file[] = {"libpcap.dylib", "libpcap.A.dylib"}; int i, count = 2; #else char *file[] = {"libpcap.so", "libpcap.so.1", "libpcap.so.1.0", "libpcap.so.0.9", "libpcap.so.0.8"}; int i, count = 5; #endif for (i=0; i typedef void NotifyNotification, GtkWidget, GError; typedef char gchar; typedef int gint, gboolean; static gboolean (*notify_notification_update)(NotifyNotification *, const gchar *, const gchar *, const gchar *); static void (*notify_notification_set_timeout)(NotifyNotification *, gint); static gboolean (*notify_notification_show)(NotifyNotification *, GError **); static void *libnotify = NULL; static NotifyNotification *notify = NULL; int load_libnotify(void) { char *error; gboolean (*notify_init)(const char *); NotifyNotification *(*notify_notification_new)(const gchar *, const gchar *, const gchar *, GtkWidget *); #ifdef MAC_OS char *file[] = {"libnotify.dylib", "libnotify.1.dylib"}; int i, count = 2; #else char *file[] = {"libnotify.so", "libnotify.so.1"}; int i, count = 2; #endif for (i=0; i