mongo/buildscripts/bazel_testbuilds/unit_test.cpp
Zack Winter cfdad5342e SERVER-101032 Move clang-format into "bazel run format" (#36625)
GitOrigin-RevId: 14b3ac27154b9dfcbabaf6d296a6ee6e466d222a
2025-05-29 13:40:00 +00:00

22 lines
626 B
C++

// C++ compilation file used for testing bazel compilation.
#include <iostream>
#include <dlfcn.h>
int main() {
void* tcmalloc_so = dlopen(
"/home/ubuntu/mongo/bazel-bin/_solib_arm64/"
"libsrc_Sthird_Uparty_Sgperftools_Slibtcmalloc_Uminimal.so",
RTLD_NOW);
void* tcmalloc = dlsym(tcmalloc_so, "malloc");
void* libcmalloc_so = dlopen("/lib/aarch64-linux-gnu/libc.so.6", RTLD_NOW);
void* libcmalloc = dlsym(libcmalloc_so, "malloc");
printf("%p [unit test malloc]\n", malloc);
printf("%p [tcmalloc]\n", tcmalloc);
printf("%p [libc malloc]\n", libcmalloc);
return 0;
}