diff options
| -rw-r--r-- | dlfcn.c | 5 | ||||
| -rw-r--r-- | test.c | 17 | ||||
| -rw-r--r-- | testdll.c | 5 |
3 files changed, 27 insertions, 0 deletions
| @@ -17,6 +17,11 @@ | |||
| 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | */ | 18 | */ |
| 19 | 19 | ||
| 20 | #ifdef _DEBUG | ||
| 21 | #define _CRTDBG_MAP_ALLOC | ||
| 22 | #include <stdlib.h> | ||
| 23 | #include <crtdbg.h> | ||
| 24 | #endif | ||
| 20 | #include <windows.h> | 25 | #include <windows.h> |
| 21 | #include <stdio.h> | 26 | #include <stdio.h> |
| 22 | 27 | ||
| @@ -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 | } |
| @@ -17,6 +17,11 @@ | |||
| 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | */ | 18 | */ |
| 19 | 19 | ||
| 20 | #ifdef _DEBUG | ||
| 21 | #define _CRTDBG_MAP_ALLOC | ||
| 22 | #include <stdlib.h> | ||
| 23 | #include <crtdbg.h> | ||
| 24 | #endif | ||
| 20 | #include <stdio.h> | 25 | #include <stdio.h> |
| 21 | 26 | ||
| 22 | #if defined(_WIN32) | 27 | #if defined(_WIN32) |
