Recent

Author Topic: Generating a wrapper for dynamically-loaded libraries  (Read 339 times)

MarkMLl

  • Hero Member
  • *****
  • Posts: 8170
Generating a wrapper for dynamically-loaded libraries
« on: January 22, 2025, 11:02:42 am »
I've uploaded the class that, for many years, I've used as a wrapper for .DLL and .so files to https://github.com/MarkMLl/dynamod This allows a library to be declared as a class, that is opened when the class is instantiated; with care libraries may be closed and reopened if a later version becomes available without disrupting the caller's operation.

See https://github.com/MarkMLl/dsocat for an example.

I've also, in the same repository, put the defToSDUnits program that I've used for several years to convert a .inc file (typically generated by h2pas) into a form in which it can be used for either static or dynamic linkage: static linkage simplifies debugging, dynamic linkage allows graceful failure if a library is missing at runtime (as well as plugin reloading etc.). This builds on what was originally a MIDI filter written in the early 2010s, I'm fairly confident in its underpinnings.

An example is at https://github.com/MarkMLl/dynamod/tree/main/demo but this is also what I used to generate the files at https://github.com/MarkMLl/asound (these took a lot of fiddling to get function documentation into the .inc file, but after that conversion was automatic).

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

 

TinyPortal © 2005-2018