When it resolved symbol-only variables, the expression parser currently looks only in the global module list. It should prefer the current module.
I've fixed that behavior by making it search the current module first, and only search globally if it finds nothing. I've also added a test case.
For a portable way to write a Makefile with multiple shared libraries, please look at testcases/lang/cpp/namespace_definitions. The solution is not very elegant, but at least it avoid hardcoding .dylib everywhere.