diff options
Diffstat (limited to 'test.c')
-rw-r--r-- | test.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -18,6 +18,11 @@ | |||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifdef _DEBUG | ||
22 | #define _CRTDBG_MAP_ALLOC | ||
23 | #include <stdlib.h> | ||
24 | #include <crtdbg.h> | ||
25 | #endif | ||
21 | #include <stdio.h> | 26 | #include <stdio.h> |
22 | #include "dlfcn.h" | 27 | #include "dlfcn.h" |
23 | 28 | ||
@@ -71,6 +76,15 @@ int main() | |||
71 | int (*nonexistentfunction)( void ); | 76 | int (*nonexistentfunction)( void ); |
72 | int ret; | 77 | int ret; |
73 | 78 | ||
79 | #ifdef _DEBUG | ||
80 | _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); | ||
81 | _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDOUT); | ||
82 | _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE); | ||
83 | _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDOUT); | ||
84 | _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE); | ||
85 | _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDOUT); | ||
86 | #endif | ||
87 | |||
74 | library = dlopen( "testdll.dll", RTLD_GLOBAL ); | 88 | library = dlopen( "testdll.dll", RTLD_GLOBAL ); |
75 | if( !library ) | 89 | if( !library ) |
76 | { | 90 | { |
@@ -295,5 +309,8 @@ int main() | |||
295 | else | 309 | else |
296 | printf( "SUCCESS\tClosed global handle.\n" ); | 310 | printf( "SUCCESS\tClosed global handle.\n" ); |
297 | 311 | ||
312 | #ifdef _DEBUG | ||
313 | _CrtDumpMemoryLeaks(); | ||
314 | #endif | ||
298 | return 0; | 315 | return 0; |
299 | } | 316 | } |