moparisthebest
2010-09-15 02:26:56
I've been thinking about a good, cross-platform way to load libraries. Currently, if we try to load libsmart, for example, Simba will try to load libsmart.so under Linux, regardless of whether Simba is compiled as a 32-bit or 64-bit system. This doesn't always work, as libsmart.so might be either. So two different plans come to mind:
Best plan:
Backup plan (if the detection can't be done):
One of the above plans would prevent those nasty 'incompatible binary format' errors, and would enable the use of my Simba all-in-one release without the renaming of plugins every time you switch operating systems.
Either of the changes should be easy to do in Units/MMLCore/libloader.pas, so does anyone know if the first option can be done? Or should the second option be done? OR do you have a plan C? :stirthepot:
(wow, that's 3 threads for me today in this section, goodnight!)
Best plan:
- Load libsmart.so and detect if it matches our architecture (if this can be done, perhaps as simple as seeing if it was loaded successfully)
- If it wasn't successful, or doesn't match our architecture, look for and load libsmart64.so or libsmart32.so depending on what we are compiled for
Backup plan (if the detection can't be done):
- Load libsmart64.so or libsmart32.so FIRST, if they exist we are basically guaranteed to get the right one (no 64-bit plugin would be named libsmart32.so)
- If the more specific library doesn't exist, fall back to trying to load libsmart.so
One of the above plans would prevent those nasty 'incompatible binary format' errors, and would enable the use of my Simba all-in-one release without the renaming of plugins every time you switch operating systems.
Either of the changes should be easy to do in Units/MMLCore/libloader.pas, so does anyone know if the first option can be done? Or should the second option be done? OR do you have a plan C? :stirthepot:
(wow, that's 3 threads for me today in this section, goodnight!)