4 * PCB, interactive printed circuit board design
5 * Copyright (C) 2004, 2006 Dan McMahill
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
31 #ifdef HAVE_LIBDMALLOC
39 return (float) exp ((double) x
);
47 return (float) log ((double) x
);
55 return (long) rand ();
59 #if !defined(HAVE_DLFCN_H) && defined(WIN32)
63 dlopen (const char * f
, int ATTRIBUTE_UNUSED flag
)
65 return LoadLibrary (f
);
71 FreeLibrary ((HINSTANCE
) h
);
77 static LPVOID lpMsgBuf
= NULL
;
80 /* free the error message buffer */
84 /* get the error code */
87 /* get the corresponding error message */
89 FORMAT_MESSAGE_ALLOCATE_BUFFER
|
90 FORMAT_MESSAGE_FROM_SYSTEM
|
91 FORMAT_MESSAGE_IGNORE_INSERTS
,
94 MAKELANGID(LANG_NEUTRAL
, SUBLANG_DEFAULT
),
98 return (char *) lpMsgBuf
;
102 dlsym (void *handle
, const char *symbol
)
104 return (void *) GetProcAddress((HMODULE
) handle
, symbol
);