dynload_overview(3)

πŸ“¦ version 2.5.0, in fedora 43, fedora 44

πŸ’– dynload_overview πŸ’–

hiii bestie, welcome to the Library Functions Manual entry for dynload_overview 🫢 (Coin girlies, this is the Version 2.5.0 era of the docs, and we're in section 3, the library functions section, iykyk ✨). Pull up a chair, we're talking about dynamic loading of extension nodes and it's honestly kinda iconic.


🌸 NAME 🌸

dynload_overview β€” Dynamic Loading of Extension Nodes ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so picture this: Coin is trying to get hold of a node type object (SoType) for a class, based on the name string of the node type. And if no such node type has been initialized yet? It just goes and scans the file system for a dynamically loadable extension node with that given name. main character behavior fr πŸ•΅οΈβ™€οΈπŸ’…

You can completely disable this whole thing by setting the environment variable COIN_NO_SOTYPE_DYNLOAD to a positive integer value. this is new from Coin v2.5.0, no cap πŸ‘‘

now, the platform tea, because it differs everywhere and we love that for us:

  • On UNIX, extension nodes are regular .so files 🐧
  • On Win32, extension nodes are built as DLLs πŸͺŸ
  • On Mac OS X systems, extension nodes are built as .dylib files 🍎
⚠️ Note: the extension nodes have to be built using the flag -dynamiclib, not -bundle. do not come for me, that's just the rule.

Whether the dynamically loadable objects should be named with or without the lib prefix is optional. both schemes will work, so you literally cannot mess this up πŸ’–

Here's the part that's lowkey the best: people don't usually program in a way so that they instantiate new nodes through the node class' SoType object β€” but that is the way nodes are created when model files are loaded. Which means for all Coin applications that load model files, the custom extension nodes will automatically be supported for the model files, and you don't have to modify their source code and rebuild the applications. ate and left no crumbs 😭✨

wanna see it in action? See ftp://ftp.coin3d.org/pub/coin/src/dynloadsample.tar.gz for an example using two dynamically loadable extension nodes. You only use an examiner viewer to view the two extension nodes in action. it's giving demo day πŸŽ€

now the sad part πŸ™ˆ only a limited set of C++ compilers are supported as of yet. and why, you ask? because to initialize the extension node, it is necessary to know something about how the C++ compiler mangles the initClass symbol. If we don't know that, there is no way to locate the initClass method in the library, which means the extension node can not make itself known to the type system. so the whole thing just... doesn't happen. devastating, honestly πŸ’€

If your C++ compiler is not supported, the source file to add support for a new compiler in is src/misc/cppmangle.icc. It is fairly trivial to add support for new compilers, but if you don't understand how, just ask us about it 🫢 Patches with support for new compilers are of course very welcome. be the change you want to see in the mangling, bestie 🌈


🫢 See also 🫢

  • SoType

🌈 Since 🌈

  • Coin 2.0

and that's the whole page, bestie! πŸ’… this was the Coin docs, Version 2.5.0, and you just read dynload_overview(3) β€” go forth and dynamically load responsibly βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from