[comp.sys.mac.misc] DLL's for Mac?

minich@d.cs.okstate.edu (Robert Minich) (07/17/90)

by strobl@gmdzi.UUCP (Wolfgang Strobl):
| sho@maxwell.physics.purdue.edu (Sho Kuwamoto) writes:
|#In article <3053@gmdzi.UUCP> strobl@gmdzi.UUCP (Wolfgang Strobl)
writes:
|#>Sorry, I don't know what cdev's are. "TSR" is of course the
(in)famous
|#>Terminate and Stay Resident routine. What does a cdev do, and what
|#>is it used for?
 
[What a cdev is and what it's for...]
 
| Having a modular control panel is a nice thing. I prefer to have the
| initialization/configuration bound to the application itself (remember:
| almost everything is an application under Windows). And, please,
| don't compare the Mac to a PC without Windows. This is unfair.
 
  Actually, cdev's have ended up much differently than I think they were
originally envisioned. Mostly, I see them being used to modify the
"system" (in the broadest sense) in some way, whether it is setting off
a pyrotechnics display after idling for a while or controlling the 
depth/virtual positions of the monitor(s) attached. For the config
info, programs generally create a "preferences" file in the system
folder. (In fact, Sys 7 [if i recall correctly] should have a pref
folder in the system folder for this purpose!)
  Does Windows have something analogous to the System Folder, where we
put all kinds of global/system things like printer drivers, the system
folder, INIT's (which are executed at startup), cdev's, pref files,
etc.?
 
|#>The important point here is that the code of a DLL is shared
|#>by all running applications which use it. Windows itself is a
|#>collection of such DLL's. Printer drivers are DLL's
|#>with a known set of entry points. Many major applications
|#>consist of a set of DLL's and one ore more programs using
|#>these DLL's.
|
|#We don't have any sort of dynamic linking on the mac, but then again,
|#all the windowing routines are in ROM, so it's not real important.
|
| But the printer drivers, for example, are not in ROM.
|
| Wolfgang Strobl
| #include <std.disclaimer.hpp>
 
  The Mac doesn't have any official, refined DLL support, but it does
often use the functionality. For example, windows are drawn by the
system calling WDEF's, which are executable code resources. They WDEF's
are stored in the resource fork of the system file and possibly an
application. (Remember, resources in a programs most recently opened
file override those in previously opened files.) The same is true for 
MDEF's (which define menus), LDEF's (which handle lists), and so on. 
This, BTW, has been a vector for a couple viruses. (MDEF and WDEF...
who could guess!) These routines are loaded and called by the system
automagically.
  There are also programs that handle external code resources such as
HyperCard. Calling external code is not too difficult to program,
although you do have to think about what your doing. Maybe if the
development systems make it transparent, we'll be happier. What do the
calls for DLL's in windows look like? How do you get the right routine
from a DLL or recognize it is even available?
  A couple side notes: previous discussion of on the fly resource file
manipulation failed to really find an otherwise hard to do task. One
good use i've come across real recently is in sound data files. (Not to
be confused with 'snd ' resources, which the system likes.) These are
basically raw sound samples. The actual sound data is in the data fork
of the file while in the resource fork, there is an 'info' resource that
tells the length of the sample (although this is really redundant, since
the size of the data fork is easily obtainable) and the rate at which it
is to be played. This makes it easy to have a struct which you just
read/dump to a file routine rather than having a special format for
sound
files.  O'course, there is a standard format for such files (AIFF -
audio
interchange file format, I guess) that uses tagged chunks of data with
various descriptors and types.
 I guess now is an appropriate time to say that I, personally, like
discussing these things because I learn more about other systems
capabilities and shortcomings. Why shouldn't we learn from others
mistakes? Last ?: if Windows barely uses DOS at all, why on earth
doesn't Microsoft roll DOS into Windows and remove the last appearances
of being a DOS shell? Inquiring minds are boggling.
-- 
| _    /| | Robert Minich             |Q: Why is the food so lousy, and 
| \'o.O'  | Oklahoma State University |the service so bad? Time traveler:
| =(___)= | minich@d.cs.okstate.edu   |A:The waiters know in advance what 
|    U    | - Bill sez "Ackphtth"     |kind of tip they'll be getting.