/*
 * DL.h
 * (C) Christian Magnusson 1999,2000, Email: d1mag@dtek.chalmers.se
 * This program is copyright, and covered by the Gnu Public License.
 * The Q bot.
 */
#ifndef DL_H
#define DL_H

#include "os.h"
#include "settings.h"

#ifdef HAVE_UNIX_DL

#include <dlfcn.h>

typedef void* DL_HANDLE;

#elif defined(HAVE_WIN32_DLL)

#include <windows.h>

typedef HMODULE DL_HANDLE;

#endif /* HAVE_UNIX_DL */

DL_HANDLE DL_open(const char *pathname, int mode);
void *DL_sym(DL_HANDLE handle, const char *name);
int DL_close(DL_HANDLE handle);
char *DL_error(void);

int load_command(char *name);
int unload_command(char *cmd);

typedef struct dl_command_entry_t {
  char name[MAX_COMMAND_LEN + 1];
  DL_HANDLE val;
  void (*func)(char *);
  char summary[MAX_COMMAND_SUMMARY_LEN + 1];
  char help[MAX_COMMAND_HELP_LEN + 1];
  int level;
} dl_command_entry_t;

#endif /* DL_H */
