瀏覽代碼

Added InitBRL() export for lib builds.

woollybah 6 年之前
父節點
當前提交
e4f40e550e
共有 2 個文件被更改,包括 21 次插入1 次删除
  1. 1 1
      options.bmx
  2. 20 0
      parser.bmx

+ 1 - 1
options.bmx

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

+ 20 - 0
parser.bmx

@@ -4195,6 +4195,22 @@ Function ParseModule:TModuleDecl( path$,app:TAppDecl )
 	Return parser._module
 	Return parser._module
 End Function
 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 ******
 '***** PUBLIC API ******
 
 
 Function ParseApp:TAppDecl( path$ )
 Function ParseApp:TAppDecl( path$ )
@@ -4205,6 +4221,10 @@ Function ParseApp:TAppDecl( path$ )
 
 
 	Local source$=PreProcess( path )
 	Local source$=PreProcess( path )
 	'Local source:String = LoadString(path)
 	'Local source:String = LoadString(path)
+	
+	If opt_def Then
+		source = AppendLibInit(source)
+	End If
 
 
 	Local toker:TToker=New TToker.Create( path,source )
 	Local toker:TToker=New TToker.Create( path,source )