C5T / Current

C++ framework for realtime machine learning.
https://medium.com/dima-korolev/current-for-realtime-machine-learning-4f04aa8ab81a
97 stars 29 forks source link

Extracted a wrapper for `dlopen` only (it was only "compile C++ and then `dlopen`" before). #922

Closed dkorolev closed 2 years ago

dkorolev commented 2 years ago

Also, made sure that with "extern "C" the name is indeed not mangled.

mzhurovich commented 2 years ago

Nice! Tested on MacOS 12.5.1 x86_64, Apple clang version 13.1.6 (clang-1316.0.21.2.5):

$ cd bricks/system; make test
g++ -std=c++17 -W -Wall -Wno-strict-aliasing   -stdlib=libc++ -x objective-c++ -fobjc-arc -o ".current/test" "test.cc" -framework Foundation
.current/test --current_runtime_arch=Darwin
[==========] Running 8 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 8 tests from Syscalls
[ RUN      ] Syscalls.PipedOutputSingleLine
[       OK ] Syscalls.PipedOutputSingleLine (4 ms)
[ RUN      ] Syscalls.PipedOutputMultipleLines
[       OK ] Syscalls.PipedOutputMultipleLines (6 ms)
[ RUN      ] Syscalls.SystemCall
[       OK ] Syscalls.SystemCall (13 ms)
[ RUN      ] Syscalls.DLOpen
[       OK ] Syscalls.DLOpen (264 ms)
[ RUN      ] Syscalls.DLOpenExternC
[       OK ] Syscalls.DLOpenExternC (260 ms)
[ RUN      ] Syscalls.DLOpenHasCurrentHeader
[       OK ] Syscalls.DLOpenHasCurrentHeader (243 ms)
[ RUN      ] Syscalls.DLOpenHasSymlinkToCurrent
Test skipped as `--current_base_dir_for_dlopen_test` was not set.
[       OK ] Syscalls.DLOpenHasSymlinkToCurrent (0 ms)
[ RUN      ] Syscalls.DLOpenExceptions
[       OK ] Syscalls.DLOpenExceptions (303 ms)
[----------] 8 tests from Syscalls (1093 ms total)

[----------] Global test environment tear-down
[==========] 8 tests from 1 test case ran. (1094 ms total)
[  PASSED  ] 8 tests.
dkorolev commented 1 year ago

Btw, 250+ms per test is kind of slow, it's ~25ms on my Ubuntu. But these are details.