Packages and module import

Russel Winder russel at winder.org.uk
Mon Mar 19 17:29:10 UTC 2018


I had assumed that a directory of modules was a package. So for
example:

	A/a.d
	A/b.d

were two modules in package A. Especially given there is a module
statement at the beginning of each module:

A/a.d has  module A.a;
A/b.d has  module A.b;

Now A.b needs to access something from A.a. I had assumed that the
import should be fully qualified. So in A.b.d:

	import A.a: thing;

This all works when building the library.


ldc2 -of=Build/Release/libdvbv5_d.so -shared -defaultlib=phobos2-ldc Build/Release/source/libdvbv5_d/linux_dmx.o Build/Release/source/libdvbv5_d/dvb_v5_std.o Build/Release/source/libdvbv5_d/dvb_frontend.o Build/Release/source/libdvbv5_d/dvb_log.o Build/Release/source/libdvbv5_d/dvb_demux.o Build/Release/source/libdvbv5_d/dvb_fe.o Build/Release/source/libdvbv5_d/dvb_file.o Build/Release/source/libdvbv5_d/dvb_scan.o Build/Release/source/libdvbv5_d/dvb_sat.o -L-ldruntime-ldc


However when trying to build the unit-tests:


ldc2 -I=source -unittest --main -of=Build/Test/libdvbv5_d source/libdvbv5_d/linux_dmx.d source/libdvbv5_d/dvb_v5_std.d source/libdvbv5_d/dvb_frontend.d source/libdvbv5_d/dvb_log.d source/libdvbv5_d/dvb_demux.d source/libdvbv5_d/dvb_fe.d source/libdvbv5_d/dvb_file.d source/libdvbv5_d/dvb_scan.d source/libdvbv5_d/dvb_sat.d
source/libdvbv5_d/dvb_demux.d(35): Error: module linux_dmx from file source/libdvbv5_d/linux_dmx.d must be imported with 'import linux_dmx;'


Am I just missing something simple?


-- 
Russel.
===========================================
Dr Russel Winder      t: +44 20 7585 2200
41 Buckmaster Road    m: +44 7770 465 077
London SW11 1EN, UK   w: www.russel.org.uk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20180319/7f0fa80c/attachment.sig>


More information about the Digitalmars-d-learn mailing list