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