T
Tech07
Nobody said:ELF shared libraries can also be executables:
And DLLs are basically executables. I'm not the one to ask about the details
of such though (I'll cross that bridge when I reach it).
Nobody said:ELF shared libraries can also be executables:
Richard Heathfield said:Sure - at a system level. But at the level of C source, which is what
we're actually talking about (or, at least, what I'm actually talking
about, and which is topical here), the function simply isn't there.
Whether or not the system adds it as part of its internal startup
code is neither here nor there from a C source perspective.
I just created a DLL to test your theory. It has no
_DLLMainCRTStartup. It does have a lot of extraneous junk, but that
isn't one of it, so to speak.
Tech07 said:"Extra! Extra! Read all about it!":
http://msdn.microsoft.com/en-us/library/988ye33t.aspx
Would _you_ expect such code that calls your DLL to be in the DLL? Surely
it gets linked to the calling executable via the provided system
libraries.
Interestingly, the Linux kernel coding guidelines use 8 column tabs to
enforce code simplicity: if it spills over 80 columns it probably needs
to be split into a new function anyway. (Normally I'd object to this
kind of crazy blanket rule, but it seems to have served quite well over
the years.)
With 8 spaces, I always feel like my eyes have to travel too far. (It
makes it tougher to fit code in reduced margins, too, which is probably
one of the reasons for 4-space indents in K&R2.)
...SNIP..
Just my opinion, mind you. MISRA-C is a better starting point for
certain types of C coding than the alternatives, mainly because there
really are no alternatives. But it is far from perfect on its own.
I've nearly always used one space. Last time I used actual tabs, my
code would rapidly disappear off the right edge of the teletype paper
(which used 72 columns iirc).
I've been printing way more than 80 columns since the mid 1980's when working
on IBM mainframes. I had a graphics printer that did 270 columns so I split
output into 2 flow columns of 132 characters each.
DOS isn't limited to 80 columns. Usenet isn't, either, though courtesy does
urge limiting text to less than 80 (preferrably less than 72). But for code,
especially when referenced by URL, I'm back to my 132+ column formats.
Just because there are things around that some people might still use which
have no more than 80 columns, this should not limit everyone to format code
to no wider than that.
Tech07 said:I don't know what the standard says about implementations at that level (std
library initialization and the like).
The difference between him and his teachers. But he did not say one way
or the other. I was making sure.
"Extra! Extra! Read all about it!":http://msdn.microsoft.com/en-us/library/988ye33t.aspx
Would _you_ expect such code that calls your DLL to be in the DLL? Surely it
gets linked to the calling executable via the provided system libraries.- Hide quoted text -
arnuld said:4) Beej Jorgensen does not know much about programming
Richard Heathfield said:Beej has only come to (returned to?) comp.lang.c relatively recently
Anyone who thinks Beej doesn't know much about programming doesn't
know much about Beej.
Just because there are things around that some people might still use
which have no more than 80 columns, this should not limit everyone to
format code to no wider than that.
Richard said:Clearly we are disagreeing over the meaning of the term "entry point".
For me, the entry point into code is within the code itself, just as
the front door of a house is in the actual house. Right on the edge?
Sure. That's where entry points have to be. But it is actually in the
house, nonetheless. Go to the house, see the door(s). Go to the code,
see the entry point(s). If I look carefully all around the code and,
despite finding several ways into it (i.e. the entry points), can't
find the function you mention, then the function you mention is not
an entry point as far as I'm concerned.
Bart said:This seems to be about link-loaders specific to the C language. They
can do what they like regarding the entry points they need to
initialise the CRT, and I would expect they are all a little
different.
The link you provided was concerned with the C++ language, and
presumably MS's version of it.
I wouldn't trust the linkers
I use at the minute (lcc-win and gcc for
Windows) not to put in any C-specific gummph in the executables. Maybe
there are complicated options to omit all C-related setup code and
entry points, and produce a pure, language-agnostic executable, but
I've no idea what they might be.
(With 16-bit Windows however, I did make my own arrangements for
creating executables, and those *were* much purer (I wasn't using the
CRT then). IIRC they included a list of imported Dlls and functions,
to allow OS routines to be called.)
So I doubt DLLMainCRTStartup would be an entrypoint meaningful to
Windows,
it sounds like something created by your specific C
implementation.
The clue is in that "CRT", while presumably DLLs can
have been created in any language.
One of these days I might create my own loader for creating PE-format
executables, and I'll be able to back up my claim. But don't hold your
breath.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.