TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Ian Hinson
from: David Nugent
date: 1994-10-03 19:30:16
subject: How to include own .h fi

GN> That's not quite right.  Vendor supplied routines are
 GN> 'defined' by using #include, but the code itself usually
 GN> resides in libraries which are linked in when producing the
 GN> executable.

 IH> Thanks for that. In hindsight, I must have been wildly optimistic to
 IH> think it would work.  I had somehow gotten the idea that #include .h
 IH> was supposed to be similar to (and straightforward as) TP's 'USES
 IH> unitname'.

It can be.

Some compilers include special #pragma's which allow you to specify linkage
with particular libraries etc, and in the case of a .h file which
represents the contents of a library it can be advantageous to do that.

However, unlike TP, the C language is used in a multitude of operating
environments, so the assumption that this can be done everywhere is not a
valid one. The ISO have forumed a base standard library and language
standard which sets what you can _expect_ a compliant compiler vendor to
provide. Relying on these extensions is only "safe" within a
particular environment that supports it.

Personally, I avoid 'clever' extensions like that and take care of library
linkage in my make environment, using the makefile. But then again, I'm
concerned with compiler/operating system portability, so your mileage may
vary. FWIW, I use dmake, which itself has been implemented it a large
number of operating systems and environments.


 GN>Well, you can use a make file.  Every compiler 'kit' has a make utility,
 GN>and there are several non compiler-specific makes.

 IH> This info has put me onto a new 'learning curve'.

Well worth it, btw. Make, and the basic makefile syntax, is a common idiom
you'll come to know if you program in C.


 IH> I now see that
 IH> learning the C language itself is one thing (not that hard as a *2nd*
 IH> language), but mastering its programming environment is something else
 IH> again.

.. then again, you can use make in any environment, even TP.


 IH> Its a big area which most texts seem to duck out of or treat far
 IH> too briefly.

Hmm, no, but Borland docs aren't great here. Their make is actually one of
the better commercial ones, but it isn't without its limitations.


david

---

* Origin: Unique Computing Pty Ltd (3:632/348)
SEEN-BY: 50/99 54/54 620/243 623/630 624/50 632/103 301 348 386 998 633/371
SEEN-BY: 633/379 634/384 635/210 502 503 541 544 636/100 639/100 711/401 409
SEEN-BY: 711/410 430 807 808 809 932 934 942 712/623 713/888 714/906 800/1
@PATH: 632/348 635/503 50/99 54/54 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.