/*
 GerberConversion
 Copyright (C) 2010 Martin Štrympl
 
 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public
 License as published by the Free Software Foundation; either
 version 3.0 of the License, or (at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 General Public License for more details.
 
 You should have received a copy of the GNU General Public
 License along with this program.
 
 Martin Štrympl
 xstrym00@stud.feec.vutbr.cz
 */
 
/*
 *  Dynamic.c
 *  GerberConversion
 *
 *  Created by Martin Štrympl on 11/4/10.
 *  Copyright 2010 School. All rights reserved.
 *
 */
 
#include "Dynamic.h"

#ifndef __WIN32__
#include <dlfcn.h>
DLHANDLE DLOPEN(const char *t_name)
{
  return (DLHANDLE *)dlopen(t_name, RTLD_NOW);
}
void DLCLOSE(DLHANDLE td_lib)
{
  dlclose(td_lib);
}
void * DLOBJECT(DLHANDLE td_lib, const char *t_name)
{
  return dlsym(td_lib, t_name);
}
#else
DLHANDLE DLOPEN(const char *t_name)
{
  return (DLHANDLE)LoadLibrary(TEXT(t_name)); ;
}
void DLCLOSE(DLHANDLE td_lib)
{
  FreeLibrary(td_lib);
}
void * DLOBJECT(DLHANDLE td_lib, const char *t_name)
{
  return GetProcAddress(td_lib, t_name);
}
#endif
