1 /*
2 *
3 *
4 * --------------------------------------------------------------------------
5 *
6 * Pthreads-win32 - POSIX Threads Library for Win32
7 * Copyright(C) 1998 John E. Bossom
8 * Copyright(C) 1999,2005 Pthreads-win32 contributors
9 *
10 * Contact Email: rpj@callisto.canberra.edu.au
11 *
12 * The current list of contributors is contained
13 * in the file CONTRIBUTORS included with the source
14 * code distribution. The list can also be seen at the
15 * following World Wide Web location:
16 * http://sources.redhat.com/pthreads-win32/contributors.html
17 *
18 * This library is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU Lesser General Public
20 * License as published by the Free Software Foundation; either
21 * version 2 of the License, or (at your option) any later version.
22 *
23 * This library is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26 * Lesser General Public License for more details.
27 *
28 * You should have received a copy of the GNU Lesser General Public
29 * License along with this library in the file COPYING.LIB;
30 * if not, write to the Free Software Foundation, Inc.,
31 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
32 *
33 * --------------------------------------------------------------------------
34 * From: Todd Owen <towen@lucidcalm.dropbear.id.au>
35 * To: pthreads-win32@sourceware.cygnus.com
36 * Subject: invalid page fault when using LoadLibrary/FreeLibrary
37 *
38 * hi,
39 * for me, pthread.dll consistently causes an "invalid page fault in
40 * kernel32.dll" when I load it "explicitly"...to be precise, loading (with
41 * LoadLibrary) isn't a problem, it gives the error when I call FreeLibrary.
42 * I guess that the dll's cleanup must be causing the error.
43 *
44 * Implicit linkage of the dll has never given me this problem. Here's a
45 * program (console application) that gives me the error.
46 *
47 * I compile with: mingw32 (gcc-2.95 release), with the MSVCRT add-on (not
48 * that the compiler should make much difference in this case).
49 * PTHREAD.DLL: is the precompiled 1999-11-02 one (I tried an older one as
50 * well, with the same result).
51 *
52 * Fascinatingly, if you have your own dll (mycode.dll) which implicitly
53 * loads pthread.dll, and then do LoadLibrary/FreeLibrary on _this_ dll, the
54 * same thing happens.
55 *
56 */
57
58 #include "test.h"
59
main()60 int main() {
61 HINSTANCE hinst;
62
63 //assert((hinst = LoadLibrary("pthread")) != (HINSTANCE) 0);
64
65 Sleep(100);
66
67 //FreeLibrary(hinst);
68 return 0;
69 }
70
71