r/cpp • • Oct 10 '19

10 differences between static and dynamic libraries every C++ developer should know

https://www.acodersjourney.com/cplusplus-static-vs-dynamic-libraries/
5 Upvotes

25 comments sorted by

View all comments

1

u/ShakaUVM i+++ ++i+i[arr] Oct 10 '19

Is there an easy way to enumerate all the function names in a dynamic library? I'd like to make an AI tournament with an unknown number of competitors

4

u/drcforbin Oct 10 '19

On Linux, nm will do it, on Windows, dumpbin.

1

u/ShakaUVM i+++ ++i+i[arr] Oct 11 '19

Thanks

From inside of C++, though? I have been searching for some function that will return a list of functions in a so file so that I can find all functions starting with AI_ (like AI_Bob, AI_Charles, etc.) and have my game server put them in a match with each other without having to recompile each time.

Competitors would enter their AI into the competition by copying their so file to the executable's directory.

I could probably system() nm and parse the results, but that seems a bit clunky.