Re: OTOH, you folks are smart ...
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Tue, 18 Sep 2007 09:58:24 -0400
See below...
On Tue, 18 Sep 2007 08:09:17 -0500, "BobF" <rNfOrSePeAzMe@xxxxxxxxxxx> wrote:
*****
"David Ching" <dc@xxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:uZPHi.54273$YL5.9691@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
"BobF" <rNfOrSePeAzMe@xxxxxxxxxxx> wrote in message
news:eBYzdye%23HHA.3800@xxxxxxxxxxxxxxxxxxxxxxx
The _DLLEntry function is common to any app built with the SDK. The lib
isn't the end goal - a DLL is the end goal. The entry function just
happens to be common to *every* app built with the SDK.
The idea of creating the lib is to "clean up" the process of using the
SDK. IOW, remove the need to include a compilation of the SDK for each
app build.
Why does your library need to have the function named _DLLEntry? Why
don't you rename it to something else that doesn't conflict? Telling the
user to revise the link order is a real pain to the user and largely
negates the simplicity of supplying a .lib instead of building the SDK
modules in each sample.
I agree. The SDK provider doesn't supply a lib, the supply a handful of
source files. They never even suggest going the lib route.
There's nothing wrong with building a library. The error is in having a function that
resembles a DLL entry point function. This is a mistake. There must be NO code that has
to be done at DllMain time, because the concept does not exist in a static library.
Instead, as already suggested, you would have a separate init function. Every function
that depended upon having this initialization done would start out
if(!initialized)
InitializeMe();
which is the ONLY way this can be done in a static library. Then your DLL is just a
particular instance of a build that happens to link into a DLL instead of a .exe.
Note that all variable names would need to be scoped in some way; in C++, you can define a
class to handle this so there is no conflict, or use a namespace, but in pure C, you have
to make sure that all function names and all variable names have a unique feature so they
cannot conflict with other names the user is using.
Since using these in a static build already does not require a DllMain entry point, why is
it that you need to add one?
****
As I alluded to in a different reply in this thread, I'm not "dead in the
water" with the SDK. This has become an academic exercise for my own
edification. To be fair, I should point out that this is a cross-platform
SDK, so I don't expect too much along the lines of optimizing for the M$
build process.
I find the M$ offensive. I dealt with IBM, Sun and Apollo many years ago, who overcharged
VASTLY for their compilers, none of which were as good as the MS compiler, and a couple of
which had deep and very serious bugs "which we'll fix in the next release, next year,
maybe". You have not seen rapacious pricing until you've worked with other vendors.
Microsoft's products are very inexpensive for what they do
*****
Joseph M. Newcomer [MVP]
BTW, functions starting with '_' are considered private by convention, so
having a library that has a public function named '_' is a little strange.
Unless the '_' was put there by the C calling convention (i.e. the
compiler generated it).
Yep!
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- Follow-Ups:
- Re: OTOH, you folks are smart ...
- From: BobF
- Re: OTOH, you folks are smart ...
- References:
- OT: OTOH, you folks are smart ...
- From: BobF
- Re: OTOH, you folks are smart ...
- From: David Ching
- Re: OTOH, you folks are smart ...
- From: BobF
- Re: OTOH, you folks are smart ...
- From: David Ching
- Re: OTOH, you folks are smart ...
- From: BobF
- OT: OTOH, you folks are smart ...
- Prev by Date: Flicker free scrolling in a CFormView - ClistCtrl
- Next by Date: Re: passing a string to a dll
- Previous by thread: Re: OTOH, you folks are smart ...
- Next by thread: Re: OTOH, you folks are smart ...
- Index(es):
Relevant Pages
|