Namespace, or something

BlitzMax Forums/BlitzMax Programming/Namespace, or something

JoshK(Posted 2011) [#1]
I have a lot of classes and functions in Leadwerks3D that have the same name as BlitzMax types and functions. Stream, ReadFile(), DrawImage(), etc.

Right now I am using an imported .bmx file where all the functions and classes are externed. Every class and function is prefixed with "LE"; LEStream, LEReadFile(), etc.

Can anyone suggest a way to declare these that won't interfere with BlitzMax commands, but is nicer to use than what I am doing now?


xlsior(Posted 2011) [#2]
Not sure if this is what you are referring to, but... IIRC blitzmax can cope with duplicate names just fine if you explicitly include the scope name when calling them...

e.g. if your module has a 'drawimage()' function you can call it by referring to it as modulename.drawimage() from elsewhere in the program without explicitly naming it such, without interferring with the existing drawimage() in BRL's own modules if you imported those first.


JoshK(Posted 2011) [#3]
I suppose that's probably the best approach.


JoshK(Posted 2012) [#4]
This is interesting. If I run this code, it builds fine:
SuperStrict

Framework brl.system
Import leadwerks.leadwerks3d
Import brl.stream

Function do(stream:brl.stream.TStream)
	ReadLine stream
EndFunction


If I import this code from another file, it complains there are multiple definitions of TStream:
SuperStrict

Import leadwerks.leadwerks3d
Import brl.stream

Function do(stream:brl.stream.TStream)
	ReadLine stream
EndFunction