Dynamic Library Loader – My first published GitHub project!

A few weeks ago, I began a live-streamed coding project to develop a game engine named DarkGlass using Delphi. When I began the project, I knew that it was possible that several useful libraries might drop out of the development process, and so I have been working to separate the concerns of each piece of the code. Today, my first “useful” code library from that project can be considered at release status.

The darkDynLib library.

Okay, so my opening paragraph has a couple of slight exaggerations.

First, to call the project at release status is perhaps a stretch. You could can consider this a beta release. And second, to call the library useful is certainly accurate, but by the narrowest of margins. This library is designed simply to load dynamic libraries, such as .dll/.so/.dynlib files, and locate entry points within them. Handy for sure, but hardly a complex task. darkDynLib is, however, a cross platform library which is able to handle this task on any of Delphi’s target platforms.

This is however the first of many libraries that I plan to add to GitHub as my game project develops, and it is complete in that it has been tested to be working, and includes documentation in the form of a .chm file.

Testing Caveats.

While I am confident that this library will work for all supported Delphi targets, I have thus far only tested it on Windows (32&64) and Linux. I’ll be confirming Android, iOS and OSX support in the next few days (maybe a week). Having written a comparable library in the past, and tested that on all platforms, I know that if there are issues with the remaining platforms, they’ll be trivial to correct. If you try it and have problems, please drop me a comment here and I’ll keep you posted when testing is complete.

Conclusion

This is technically my first GitHub release, and so I wanted to share it with you.

This project moved to subversion from GitHub, find out why here : https://www.youtube.com/watch?v=z9itk3uP2Yg&t=2s and here https://chapmanworld.com/2018/08/25/why-im-now-using-both-git-and-subversion-for-one-project/

Here’s the subversion url: https://imstillfree.com/darkDynlib username: anon password: anon

I hope someone finds it useful!

Thanks for Reading!

Print Friendly, PDF & Email
Facebooktwittergoogle_plusredditpinterestlinkedintumblrmail

4 Responses

  1. May I ask why you did not just use LoadLibrary and FreeLibrary from SysUtils? They already are cross platform.

    • A couple of reasons, but the main one being I’d forgotten they were in there. You may correct me, but I think they are a recent addition to sysutils (since XE8). I’ve done this before using bindings to win32API and Posix API for much earlier versions of Delphi and FPC (before Delphi had Linux support), and so I just did it the way I’ve done it before without thinking about support in the RTL.

      • As far as I can see they have always(*) been there, a version for IFDEF POSIX (which handles every version that Delphi supports apart from Windows) and the IFDEF MSWINDOWS one.

        (*) I looked back down to XE.

        • Fair enough.
          I guess I could have used them but just went with what I’ve done before.

          As it happens, I’m still pleased to have wrapped the calls in a class with an interface, because for certain library imports I’m considering deriving the class and adding the imported symbols as methods.

Leave a Reply