473,770 Members | 6,158 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

resource-only dll

when creating a resource-only dll, the only way I can get it to compile and
work correctly, is to make it a non-resource-only dll.
surely this can't be the way...?
basically, there is a load of resources, in a dll. The DLL is a managed
class library, but it has got an unmanaged function that accesses the
resources. FindResource only works on the HMODULE that is gained by casting
the HINSTANCE passed to DllMain into an HMODULE (I think they're the same
thing anyway.)
There is also a manged class to be accessed from a C# application, this bit
works fine. But it is just the /NOENTRY option that is baffling me.
The return value of GetModuleHandle , doesn't work - as in, it can't find the
resources with this handle.
Apart from the DLL resources, the only things in the DLL are some C code
just to access the resources, and the managed class.
How can I make it a resource-only managed DLL with C code in it, if
compiling it with /NOENTRY means that DllMain doens't get called? (which it
doesn't.)
Nov 17 '05 #1
8 1820
"Bonj" <benjtaylor at hotpop d0t com> wrote in message
news:eD******** ******@TK2MSFTN GP09.phx.gbl
when creating a resource-only dll, the only way I can get it to
compile and work correctly, is to make it a non-resource-only dll.
surely this can't be the way...?
basically, there is a load of resources, in a dll. The DLL is a
managed class library, but it has got an unmanaged function that
accesses the resources.
Then how is it a resource-only DLL? A resource-only DLL - surprise
here - only contains resources, but no code. Yours is not a resouce-only
DLL, obviously.
How can I make it a resource-only managed DLL with C code in it


"Resource-only DLL with code in it" is an oxymoron.
--
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
Nov 17 '05 #2
so it *must* have an entry point, in order to get an HMODULE?

"Igor Tandetnik" <it********@mvp s.org> wrote in message
news:eV******** ********@TK2MSF TNGP09.phx.gbl. ..
"Bonj" <benjtaylor at hotpop d0t com> wrote in message
news:eD******** ******@TK2MSFTN GP09.phx.gbl
when creating a resource-only dll, the only way I can get it to
compile and work correctly, is to make it a non-resource-only dll.
surely this can't be the way...?
basically, there is a load of resources, in a dll. The DLL is a
managed class library, but it has got an unmanaged function that
accesses the resources.


Then how is it a resource-only DLL? A resource-only DLL - surprise here -
only contains resources, but no code. Yours is not a resouce-only DLL,
obviously.
How can I make it a resource-only managed DLL with C code in it


"Resource-only DLL with code in it" is an oxymoron.
--
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

Nov 17 '05 #3
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...b;en-us;814472
"Igor Tandetnik" <it********@mvp s.org> wrote in message
news:eV******** ********@TK2MSF TNGP09.phx.gbl. ..
"Bonj" <benjtaylor at hotpop d0t com> wrote in message
news:eD******** ******@TK2MSFTN GP09.phx.gbl
when creating a resource-only dll, the only way I can get it to
compile and work correctly, is to make it a non-resource-only dll.
surely this can't be the way...?
basically, there is a load of resources, in a dll. The DLL is a
managed class library, but it has got an unmanaged function that
accesses the resources.


Then how is it a resource-only DLL? A resource-only DLL - surprise here -
only contains resources, but no code. Yours is not a resouce-only DLL,
obviously.
How can I make it a resource-only managed DLL with C code in it


"Resource-only DLL with code in it" is an oxymoron.
--
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

Nov 17 '05 #4
"Bonj" <benjtaylor at hotpop d0t com> wrote in message
news:ud******** ******@TK2MSFTN GP12.phx.gbl
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...b;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.
--
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
Nov 17 '05 #5
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
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.

So an *actual* resource only DLL is just basically a flat binary file?
Nov 17 '05 #6
> 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/mu...ngunicode.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 :-)

--
Mihai
-------------------------
Replace _year_ with _ to get the real email
Nov 17 '05 #7
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.

Nov 17 '05 #8
"Bonj" <benjtaylor at hotpop d0t com> wrote in message
news:O9******** ******@TK2MSFTN GP15.phx.gbl
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.
--
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
Nov 17 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
13170
by: Danny Pressley | last post by:
I have a VS.NET 2003 Visual C++ MFC Application Project in which I added a new resource file, I then added an icon to this new resource file and did a rebuild and got the following error: "fatal error CVT1100: duplicate resource. type:ICON, name:1, language:0x0409". But the resource ID is unique and only located in the new Resource1.h and MyResourceFile.rc files. Any ideas why this error is occuring? To generate the issue real quick, you...
2
1688
by: Joe Thompson | last post by:
Hi, I am trying to use PlaySound in a VC++.net Windows app (VS 2003). I can use it to play a file but now I want to play it from a resource. I have two questions: How do I add a wav file to my project as a resource (steps please) How do I call PlaySound once that I have the wav file as part of the resource.
0
2199
by: Johann Blake | last post by:
I'm having trouble grasping how ASP.NET correctly locates resources. There is plenty of documentation on this subject but some things are not clear at all. In my ASP.NET application, I have multiple web forms. When you compile the application, it creates a DLL. If you view this DLL using ILDASM (the manifest), it shows info about the resources stored in the DLL. There is essentially an embedded resource "section" for each web form. The...
3
3337
by: al | last post by:
Hi, I use a resource file (.resx) to store user's settings such as language and other strings. The problem i'm facing is that when the user changes one of the strings in the resource file, those changes are shown by VB.NET untill after the user reloads the app. Is there any work-around for this behavior so changes can appear without relaoding the app??
2
6217
by: Al | last post by:
Hi, I have created a solution with two projects in it - a class library and a windows forms front end. I have added a resource file (Resources.resx) to the class library and filled it with icons. Does anybody know how would I go about using an icon from this resource file in the windows forms project? Thanks in advance, Al.
11
1981
by: Alan T | last post by:
I added a resource file into my project, to store the caption of buttons and labels.. How do I make use of this resource file to dynamically assign to the buttons and labels ?
1
2114
by: Chukkalove | last post by:
I originally created several "copy" resource reader classes which worked great individually, but after I converted them into an parent class with children they no longer find the resources. Each project contains its own reader class and resource .resx file from where a string or image is read. Can someone tell me what I need to do to get them to work please. I attach code. Im not sure if it's because the derived classes are in...
21
6791
by: DiAvOl | last post by:
Hello, I am using a simple php server that I wrote and have some questions related to the resource id's. When a new client connects to the server or the server opens a file the Resource id number increases normally, but when the server closes the socket and the file and then a new client connects or file opens, the Resource id still increases without reseting to the previous closed id's. For example:
12
5278
by: TS | last post by:
i have a need to possibly enable mutli language support. What benefit do i get by using a resource file instead of a custom xml solution? thanks!
0
1505
by: CSharper | last post by:
Just curious, When you are in IDE, you are able to add a resource to the project through resource tab. Later this resource can be accessed using the resource manager. One good thing about this approach is that, the resource file is build into the exe and using resource manager you can later get already added resource file back. Now is it possible to do that through programatically? I want to add a resource to the default resource (if I use...
0
9425
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10005
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8887
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7416
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6679
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5313
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3972
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3576
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2817
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.