No - hang on, it can be a resource-only DLL with code in it. That isn't
contradictory. Being a resource-only DLL, meaning that it has got the
'resource only DLL ' compiler option checked. Not that it hasn't got any
code in it. If you put the 'resource only DLL' option on (/NOENTRY) it still
compiles and works when it's got code in it. It's just it has no way (that I
know of...) of getting an HMODULE that can access the resources.... but my
reason for posting, perhaps I can get the HMODULE in the same way that a
'resource-only' DLL which truly hasn't got any code in it gets its
HMODULE....no?
The only reason I want to use the /NOENTRY is to get rid of a linker
warning, see
http://support.microsoft.com/default.aspx?scid=kb;en-us;814472
> No - hang on, it can be a resource-only DLL with code in it.
It cannot, by definition. A resource-only DLL has _resources_ _only_ -
that's why it's called resource-only in the first place. If it has code
as well as resources, it is _not_ resource-only, because it has code in
additon to resources. I don't know how I could possibly state it any
clearer.
> That
> isn't contradictory. Being a resource-only DLL, meaning that it has
> got the 'resource only DLL ' compiler option checked.
This option only works properly when the DLL does not have any code in
it - in other words, when it is resource-only.
> Not that it
> hasn't got any code in it. If you put the 'resource only DLL' option
> on (/NOENTRY) it still compiles and works
If it works, why are you here asking questions? Apparently, it does not
work all that well.
Also, if you are OK with having code in it, why do you insist on
/NOENTRY? The point of /NOENTRY with a resource-only DLL is to make it
smaller, by having the linker throw away the code segment. But you
cannot throw away the code segment, since you have code in the DLL. So
what again is the point of the exercise?
> but my reason for posting, perhaps
> I can get the HMODULE in the same way that a 'resource-only' DLL
> which truly hasn't got any code in it gets its HMODULE....no?
A resource-only DLL that has no code does not get its own HMODULE -
there's no code in it to "get" anything. It's just a data file in a
certain format. The code (in some other EXE or DLL) that wishes to use
this data file obtains HMODULE by calling LoadLibraryEx with
LOAD_LIBRARY_AS_DATAFILE flag.
> The only reason I want to use the /NOENTRY is to get rid of a linker
> warning, see
> http://support.microsoft.com/default.aspx?scid=kb;en-us;814472
Ah, that's a different question. I don't quite see how a mixed DLL is
supposed to obtain its own HMODULE, considering that it's not allowed to
implement DllMain. You may want to start another thread with this
question.

Signature
With best wishes,
Igor Tandetnik
"On two occasions, I have been asked [by members of Parliament], 'Pray,
Mr. Babbage, if you put into the machine wrong figures, will the right
answers come out?' I am not able to rightly apprehend the kind of
confusion of ideas that could provoke such a question." -- Charles
Babbage
Bonj - 20 Oct 2004 06:51 GMT
> If it works, why are you here asking questions? Apparently, it does not
> work all that well.
Define "apparently ... does not work all that well" ?
If I go one route, I have got the linker telling me my application might not
run correctly, yet it does. If go another route, I have got you telling me
it might not run correctly, yet it does. It's also confusing how they don't
put up a message box saying 'Sorry, this DLL can't be resource only. The
wizard has detected some code.'
To be fair, I am more inclined to believe you, as you have got a sensible
argument whereas the linker hasn't. But it's still confusing.
> Also, if you are OK with having code in it, why do you insist on /NOENTRY?
> The point of /NOENTRY with a resource-only DLL is to make it smaller, by
[quoted text clipped - 11 lines]
> this data file obtains HMODULE by calling LoadLibraryEx with
> LOAD_LIBRARY_AS_DATAFILE flag.
So an *actual* resource only DLL is just basically a flat binary file?
Igor Tandetnik - 20 Oct 2004 14:55 GMT
>> If it works, why are you here asking questions? Apparently, it does
>> not work all that well.
>
> Define "apparently ... does not work all that well" ?
It seems to me, based on the very fact that you had to ask a question in
the first place, that you are not completely satisfied with the
performance of your setup. Is that a clear enough explanation?
> If I go one route, I have got the linker telling me my application
> might not run correctly, yet it does. If go another route, I have
> got you telling me it might not run correctly, yet it does.
The linker warns about a different, completely unrelated issue. Not
about your resource setup, but about a problem in .NET CLR whereby mixed
mode DLLs may sometimes lock up upon loading unless DllMain is disabled.
The reason is that, if DllMain is not disabled, it may end up running
managed code, and managed code may deadlock when run under a loader
lock. The KB article you quote, as well as the whitepaper referred to by
the KB, go into this problem in great detail.
Again, this has nothing to do with your DLL containing or not containing
resources. Trying to make it a resource-only DLL is a wild goose chase -
forget about it. This is not your problem, your problems lie elsewhere.
That's why I suggest you start a new thread with a more specific
question - since a mixed mode DLL has to disable DllMain, how should it
obtain its own HMODULE?
> So an *actual* resource only DLL is just basically a flat binary file?
Basically, yes.

Signature
With best wishes,
Igor Tandetnik
"On two occasions, I have been asked [by members of Parliament], 'Pray,
Mr. Babbage, if you put into the machine wrong figures, will the right
answers come out?' I am not able to rightly apprehend the kind of
confusion of ideas that could provoke such a question." -- Charles
Babbage
Mihai N. - 20 Oct 2004 07:06 GMT
> A resource-only DLL that has no code does not get its own HMODULE -
> there's no code in it to "get" anything. It's just a data file in a
> certain format. The code (in some other EXE or DLL) that wishes to use
> this data file obtains HMODULE by calling LoadLibraryEx with
> LOAD_LIBRARY_AS_DATAFILE flag.
It is a (not so well) known problem with this.
See here (search for LOAD_LIBRARY_AS_DATAFILE)
http://www.microsoft.com/msj/0499/multilangunicode/multilangunicode.aspx
Basically, on Windows 95 (9x ?) the "resource only dll" aproach does not work
properly. This is why I would recomand to use another popular name
"satellite DLL," and add a dummy DLLMain (as also recomended by the article).
Ok, this seems to be no problem if you don't support Windows 95.
But, really, why not be 100% compatible, when the price is so low?
And the article is a great read, regardless the dll question :-)

Signature
Mihai
-------------------------
Replace _year_ with _ to get the real email
Bonj - 20 Oct 2004 10:21 GMT
Ah! "Satellite DLL" could be what I am after... I'll take a look at the
article. I'm not planning on supporting Win95 anyway as it's virtually
extinct now and my application uses a .NET front end which won't run on Win95
anyway.