Creating dlls for various OS?

BlitzMax Forums/BlitzMax Beginners Area/Creating dlls for various OS?

explosive(Posted 2008) [#1]
Hello everybody,

how can I use a dll in BlitzMax under Windows (LoadLibraryA) and Linux as well? I guess Mac doesn't work and I have to rewrite that stuff.

Example...
The dll I want to write communicates over the RS232 to the hardware and returns the result to BM. Can I use the same library on both systems?

For Mac I have to find another way.

Greetings
Simon


Retimer(Posted 2008) [#2]
If you can compile the library under both yes.

Windows uses .dlls, and *nix uses .so

Changing the extension won't do it. You'll need the library compiled under each.


Brucey(Posted 2008) [#3]
You can get USB->Serial converters which work well on the Mac.

If you write your code in such a way that allows you to compile it for the three platforms, it should work fine.
I've got a working cross-platform serial module (tested on Mac, Linux and Win32) using the same high-level API, so it's perfectly doable.
The tricky bit is accessing the various system APIs/ports, but once you have the line opened, it's all pretty much the same everywhere.

Good luck! :-)


JaviCervera(Posted 2008) [#4]
I have a cross-platform library written in BlitzMax to load a dll (.so on Linux, .dylib on OS X) and get the function pointers. I can release it as public domain if anyone is interested (would be cool to see it added to BlitzMax "pub" repository, since I think is a useful addition).


fredborg(Posted 2008) [#5]
@Jedive: Yes, please :)


Kistjes(Posted 2008) [#6]
I'm interested!