BlitzMax Linux makeso

BlitzMax Forums/BlitzMax Programming/BlitzMax Linux makeso

Starkkz(Posted 2013) [#1]
I've been trying to research a little on Linux libraries, as there was available a makedll program for Windows. I'm able to compile some shared object libraries (.so), but when I try to load it I have problems with __bb_blitz_blitz (undefined symbol). If anyone wants to use it or improve it, I'll put the source code here.

Strict

Local bmaxpath:String = BlitzMaxPath()+"/"
Local source:String

If AppArgs.length > 1
	source = AppArgs[1]
Else
	End
End If

If FileType(bmaxpath+"bin/bmk") <> 1
	Print "Invalid bmax root path"
	End
EndIf
	
source = RealPath(source)
If FileType(source) <> 1
	Print "Can't find bmax source file"
	End
EndIf

Local sourcepath:String = ExtractDir(source)
If Not(Right(sourcepath,1)="/") Then sourcepath :+ "/"
Local sourcename:String = StripExt(StripDir(source))

If FileType(sourcepath+sourcename) = 1
	DeleteFile(sourcepath+sourcename)
End If
If FileType(sourcepath+sourcename+".so") = 1
	DeleteFile(sourcepath+sourcename+".so")
End If

system_(bmaxpath+"bin/bmk makeapp -r -t console ~q"+source+"~q")
system_("gcc -O -shared -fPIC -o "+sourcepath+sourcename+".so "+sourcepath+".bmx/"+sourcename+".bmx.console.release.linux.x86.o -lc")
'system_(bmaxpath+"bin\ld.exe --dll -o ~q"+sourcepath+sourcename+".dll~q -L ~q"+bmaxpath+"lib~q -e _bb_DllMain ~q"+sourcepath+"makedll.def~q ~q"+bmaxpath+"tmp\ld.tmp~q")

If FileType(sourcepath+sourcename+".so") <> 1
 Print "Creation of "+sourcename+".so failed"
Else
 Print "Creation of "+sourcename+".so successful"
End If
If FileType(sourcepath+sourcename) = 1 Then
	DeleteFile(sourcepath+sourcename)
EndIf


You just have to run this program and put the path to the file in the command line.


Brucey(Posted 2013) [#2]
_bb_blitz_blitz is the initialising function for BRL.Blitz module, which is usually called by your app/binary (in order to set stuff up like the garbage collected and things)

Good luck!


Starkkz(Posted 2015) [#3]
If I use framework and I don't include BRL.Blitz, would this work?