Open talksmall opened 13 years ago
Since there is no standard way to do this, and Linux, Windows and Mac OS X have their own naming conventions (prefix, postfix, Apple Frameworks, version numbers).
A trade-off would be to use a platform agnostic libname with a vy simple mapping scheme (short term solution): For example, the shared libname 'foo' in the os:dll_load("foo") call would map to:
Windows -> foo.dll
Linux -> libfoo.so
Mac OS X -> libfoo.dylib
This would at least get the API right, until someome runs into a 'corner case'.
That won't work asis :(. os::dll_load is already used by the image-side DLL mapping code. The change you suggest would break all of the existing code that uses DLL (which means you wouldn't even be able to run a script from the command line, let alone draw anything on the screen).
On the image-side this all works right now. OSX framework mappings are handled a little differently than ordinary .dylibs, but the principle is similar and it's early days as yet for that.
...and someone ran with lightspeed into a corner case!
Enhance the disassembler to make it cross platform. Add a new member function to the os class - char* os::dll_extension() - to return the filename extension used for DLL files on a given platform and add implementations for all three platforms - os_nt.cpp, os_darwin.cpp and os_linux.cpp.
Change disassembler.cpp to use the new function when generating the name of the dll to be loaded.