Module namespace error in imported files

Archives Forums/BlitzMax Bug Reports/Module namespace error in imported files

JoshK(Posted 2012) [#1]
I have the type "TStream" declared in my own module "leadwerks.leadwerks3d". 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, even though I have explicitly defined the namespace:
SuperStrict

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

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



Htbaa(Posted 2012) [#2]
That's because it's imported by default if you don't specifically specify which modules it should link to by providing Framework (as in your first example).

BlitzMax simply doesn't allow Types to have the same name, even when they're in different 'namespaces'.

I suggest you rename it because of the conflicting name and compatibility issues you and your users will have when using this module.


JoshK(Posted 2012) [#3]
I suggest you rename it because of the conflicting name and compatibility issues you and your users will have when using this module.

The main file uses Framework, but regardless, it should work if the module namespace is specified. Otherwise, I have to add "le" to the beginning of every single one of my commands, since a lot of them conflict with BRL modules, and I can't have people guessing which commands need a special prefix or suffix.

The module namespace feature is designed to handle that situation neatly, but it seems to not be working completely.

Last edited 2012


Htbaa(Posted 2012) [#4]
A couple of years ago I posted a question about it in the forums as well. It seems that when the modules are being compiled the symbol table is a bit strange. You would expect a type or function be named something like '__bb_namespace_name', but instead it's being called '__bb_name_name'.

See http://www.blitzbasic.com/Community/posts.php?topic=81024 for my original topic.