Selaa lähdekoodia

Added InitBRL() export for lib builds.

woollybah 6 vuotta sitten
vanhempi
commit
e4f40e550e
2 muutettua tiedostoa jossa 21 lisäystä ja 1 poistoa
  1. 1 1
      options.bmx
  2. 20 0
      parser.bmx

+ 1 - 1
options.bmx

@@ -25,7 +25,7 @@ SuperStrict
 
 Import "base.configmap.bmx"
 
-Const version:String = "0.98"
+Const version:String = "0.99"
 
 Const BUILDTYPE_APP:Int = 0
 Const BUILDTYPE_MODULE:Int = 1

+ 20 - 0
parser.bmx

@@ -4195,6 +4195,22 @@ Function ParseModule:TModuleDecl( path$,app:TAppDecl )
 	Return parser._module
 End Function
 
+Function AppendLibInit:String(source:String)
+
+	Local sb:TStringBuffer = TStringBuffer.Create(source)
+	
+	sb.Append("~n")
+	sb.Append("Extern~n")
+	sb.Append("Function bbLibInit()~n")
+	sb.Append("End Extern~n")
+
+	sb.Append("Function InitBRL() Export~n")
+	sb.Append("bbLibInit()~n")
+	sb.Append("End Function~n")
+	
+	Return sb.ToString()
+End Function
+
 '***** PUBLIC API ******
 
 Function ParseApp:TAppDecl( path$ )
@@ -4205,6 +4221,10 @@ Function ParseApp:TAppDecl( path$ )
 
 	Local source$=PreProcess( path )
 	'Local source:String = LoadString(path)
+	
+	If opt_def Then
+		source = AppendLibInit(source)
+	End If
 
 	Local toker:TToker=New TToker.Create( path,source )