Re: Reusable source code



James Dow Allen wrote:
On Sep 7, 1:17 pm, Nick <3-nos...@xxxxxxxxxxxxxxxxxxxxxxxx> wrote:
You'll end up with sub-directories and fancy make files

sallysort.o: sallysort.c
rm qspecif.h
ln sallysort.h qspecif.h
cc -O -c -o sallysort.o qvariant.c
Much simpler than many makefiles.

Well yes, but you won't be able to run a parallel make if there are several instances of qvariant. I think it would be better to use an instance-specific subdirectory, say sallysort/qspecif.h, and a -I option on the "cc".

Alternatively, use a macro processor (perhaps even the C preprocessor) to generate sallysort.c from qvariant.c and sallysort.h, then compile.

That said, I do think that James' suggestion can be useful to configure and reuse C source code, or code in other languages (where it may be necessary to separate the macro expansion step from the compilation step).

--
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
. @ .
.



Relevant Pages

  • Re: C++/TCL Need Solution to Compile Error c2784
    ... There's always the "Platform SDK" from MSDN if you need the window.h stuff, ... Since I'm using the Command Prompt rather than the GUI to compile the ... I then tried to compile your source code and I kept getting the same ...
    (comp.lang.tcl)
  • Re: Debugging Newbie Question
    ... The CLR does not understand this source code and so before it ... ASP.NET, however, ASP.NET will compile your page's source code and cache ... the debugger will have IL and x86 created from ... in release mode assemblies. ...
    (microsoft.public.dotnet.faqs)
  • Re: Debugging Newbie Question
    ... The CLR does not understand this source code and so before it ... ASP.NET will compile your page's source code and cache the result ... > does this so that a debugger can attach to the code and allow you to step ... > release mode assemblies. ...
    (microsoft.public.dotnet.faqs)
  • The curse of constant fields
    ... feature in the Java language, and decided to write up about it. ... in a class, compile the changed class, and run the code manually to ... A quick search through the source code shows that there is no other ... This is true even if the usage itself is not ...
    (comp.lang.java.programmer)
  • Re: creaping coupling......
    ... In C++ it would be trivial to break that source code dependency, ... When you compile a .java module, ... In Java and C# it's asserted at compile time. ...
    (comp.object)