]> git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/flat-namespace.dtest/main.c
dyld-832.7.1.tar.gz
[apple/dyld.git] / testing / test-cases / flat-namespace.dtest / main.c
1 // BUILD(macos): $CC foo.c -dynamiclib -o $BUILD_DIR/libfoo.dylib -install_name $RUN_DIR/libfoo.dylib
2 // BUILD(macos): $CC main.c $BUILD_DIR/libfoo.dylib -o $BUILD_DIR/flat-namespace.exe -flat_namespace
3
4 // BUILD(ios,tvos,watchos,bridgeos):
5
6 // RUN: ./flat-namespace.exe
7
8
9
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <string.h>
13
14 #include "test_support.h"
15
16 int main(int argc, const char* argv[], const char* envp[], const char* apple[]) {
17 // check that the malloc in libfoo.dylib was used by looking at the content the allocated buffer
18 // <rdar://problem/31921090> strncmp is tricky for flat namespace because it is re-exporte and renamed
19 char* p1 = malloc(10);
20 if ( strncmp(p1, "##########", 10) != 0 ) {
21 FAIL("malloc() from main executable not interposed");
22 }
23
24 PASS("Success");
25 }