Building subprojects (Re: envy for "Writing Go Packages")

Graham Fawcett fawcett at uwindsor.ca
Thu May 13 11:26:07 PDT 2010


Hi BCS,

On Thu, 13 May 2010 17:31:34 +0000, BCS wrote:

>> (b) derives the list of files by including all *.d files, except those
>> in directories named 'test' and except those which contain a main()
>> function.
> 
> I'm thinking of how to make this work for the simple publication model
> of "Put it all out via HTTP/SVN/CVS/GIT/etc.". Anything that works for
> that should generalize well.

Yes, agreed, 'simple publication' is what I hope to target. I'm
confident that issues like versioning, dependencies, and cataloguing
can be addressed once 'simple publication' is stable.

> How about: Download files as needed to do imports from any local code
> but don't build them. Once you have copies of everything you need, build
> one lib per mapping rule that includes everything retrieved via that
> rule. At that point the name doesn't hardly matter at all. You can make
> it the FQN of the mapped package if you want it easy to interpret.

If I follow you, then the naming of libraries (or pre-compilation of
libraries at all) is a non-issue: we download the necessary source
files, cherry-pick the ones needed for our project, and compile them
together. Or let the compiler do the cherry-picking for us: just make
sure everything is "included" properly when we invoke the compiler,
and it can discover all the necessary modules.

I have a prototype that does roughly that already, but I was concerned
others might think the lack of a pre-compiled library was too hackish
(though I quite like it!). I think I'll proceed, and come back with
some sample code.

> As for linker flags... pragams or header comments? or how about a
> default flags file at the root of the mapped source.

Thanks to your suggestion, I just discovered 'pragma("lib", ...)'
which does exactly what I wanted, and in a canoncial way. (The only
linker flag that's especially important IMHO is '-l', and this pragma
addresses that.) So, we ask C-wrapper authors to toss in a quick
pragma, and we're off to the races.

Best,
Graham


More information about the Digitalmars-d mailing list