Linking pre-compiled Mac OS X binaries to MiniB3D

BlitzMax Forums/MiniB3D Module/Linking pre-compiled Mac OS X binaries to MiniB3D

jtfrench(Posted 2011) [#1]
Just curious if any Mac users out there have had success linking pre-compiled libraries (like Newton libnewton64.a) into MiniB3D/BlitzMax apps. I know how to do it in Xcode / gcc, but I'm still a bit shakey on how BlitzMax goes about linking these for Mac.

For example, I can get klepto's extended MiniB3D to compile easily on my PC, but I'm not sure where to begin on the Mac.

• Do I use the "Import" keyword?
• Do I have to specify an absolute path to the library?
• Does it matter where the library/.a file is?
• What about headers? Should I be referencing the Frameworks directory on Mac OS X?

Thanks


ima747(Posted 2011) [#2]
Take a look at Brucy's mods, he does a lot of library linking. I think you'll need to make a blitzmax wrapper for the lib, or possibly a blitz wrapper for a C file that does the library access... depends on what's easier, I think both are possible... brucy's magic is the key :0)


AdamRedwoods(Posted 2011) [#3]
One way:
?MacOS
Import "-framework Quicktime"
'' ...or...
ModuleInfo "LD_OPTS: -framework QuickTime"
?


you could try substituting in some linker commands to see which ones work, just make sure you Import the header.h file
ModuleInfo "LD_OPTS: -lmylib.a"



jkrankie(Posted 2011) [#4]
Doesn't warner's engine link newton on mac and linux?

Cheers
Charlie


kfprimm(Posted 2011) [#5]
I believe so.

My Newton module, https://github.com/kfprimm/prime.mod/tree/master/newton.mod, builds directly from source for Linux (and presumably OSX, though it's untested), but links to a DLL ('Import "newton.a"') for Windows.

As for using Import, the path given is relative to the original source file, and the lib file.

Last edited 2011


AdamRedwoods(Posted 2011) [#6]
Doesn't warner's engine link newton on mac and linux?

Yup, uses just "Import 'newton.a'"