Sebastian Hoffmann
Sebastian Hoffmann

Reputation: 11492

Windows: Meta-Information in DLL

I need to implement a minimalistic osgi-like modularization framework in C++ on Windows. Similar to Java, I want to ship modules as self-contained units, as dynamic link libraries. While .jar files are actually containers, .dll file are really some chunks of compiled code. Is it therefore even possible to store metadata inside a .dll file and access it in a C++ program?

Upvotes: 1

Views: 1297

Answers (1)

David Heffernan
David Heffernan

Reputation: 613033

The simplest way to do this is to store metadata as resources inside DLLs. You can then use the Windows API resource functions to extract the metadata. You don't even need to load the DLL as a code module, you can just load it as a data module, and then extract the metadata resources.

Use LoadLibrary to, well, load a library. Then you can use FindResource and LoadResource to extract your metadata.

Upvotes: 1

Related Questions