473,394 Members | 1,956 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Common Object within DLL

I would like to instantiate an object within a DLL for the classes
within the DLL to make use of. Is there a way to cause the DLL to
instantiate an object within itself when it is first called into action
or by some other event?
Nov 23 '05 #1
6 1381
Why do you want to do it? What is the purpose ? When you create DLLs (Class
Libraries) you can isntanitate any object from that DLL without any problem.

If you would explain yourself better (explain the problem you are trying to
solve) then someone might help you better.
Fitim Skenderi
"C Glenn" <no****@domain.com> wrote in message
news:ee*************@TK2MSFTNGP10.phx.gbl...
I would like to instantiate an object within a DLL for the classes within
the DLL to make use of. Is there a way to cause the DLL to instantiate an
object within itself when it is first called into action or by some other
event?

Nov 23 '05 #2
I think you need to clarify what you mean by "Object" when in the next
sentence you say "the classes". In .NET, an "object" is an instance of a
class.
If that's what you mean, it can be done in the contructor.
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"C Glenn" wrote:
I would like to instantiate an object within a DLL for the classes
within the DLL to make use of. Is there a way to cause the DLL to
instantiate an object within itself when it is first called into action
or by some other event?

Nov 23 '05 #3
Three classes within the DLL need to know the status of a specific table
within a database. So I've created a class that, when instantiated,
checks the status of that table, comparing it to the same data stored
locally in an XML table. The objects instantiated from the three
classes mentioned above can then make decisions based upon the
differences between the data on the server and the data within the XML
table. Naturally, I would like to consume the necessary resources and
network bandwidth as infrequently as possible.

The obvious thing to do is instantiate the object that makes this
comparison when the application first opens. But, it occurred to me
that there might be an inialization event within a DLL that would ensure
that this took place even if someone else used the same DLL for another
application in the future.

Another possibility would be to cause each instantiation of each of the
three classes that need this information to check for it themselves, but
then again, I would like to conserve resources and bandwidth.

Thanks for your help.

Peter Bromberg [C# MVP] wrote:
I think you need to clarify what you mean by "Object" when in the next
sentence you say "the classes". In .NET, an "object" is an instance of a
class.
If that's what you mean, it can be done in the contructor.
Peter

Nov 23 '05 #4
Please see my reply to Peter's post.

Fitim Skenderi wrote:
Why do you want to do it? What is the purpose ? When you create DLLs (Class
Libraries) you can isntanitate any object from that DLL without any problem.

If you would explain yourself better (explain the problem you are trying to
solve) then someone might help you better.
Fitim Skenderi
"C Glenn" <no****@domain.com> wrote in message
news:ee*************@TK2MSFTNGP10.phx.gbl...
I would like to instantiate an object within a DLL for the classes within
the DLL to make use of. Is there a way to cause the DLL to instantiate an
object within itself when it is first called into action or by some other
event?


Nov 23 '05 #5
I think one solution is to meka the classes that read the data from the
table as singletons assuming you will only read the data from the table
once, or if you need to get data from the table infrequently then you can
add a method to your singleton to refresh the loaded data from the table.

Fitim Skenderi

p.s. I know that in win32 apps, when you created a DLL in delphi (not COM,
but plain DLL), you had functions that you could implement upon loading the
DLL and upon unloading the DLL , but I haven't come accross anything like
that in C#.
"C Glenn" <no****@domain.com> wrote in message
news:uU**************@TK2MSFTNGP09.phx.gbl...
Three classes within the DLL need to know the status of a specific table
within a database. So I've created a class that, when instantiated,
checks the status of that table, comparing it to the same data stored
locally in an XML table. The objects instantiated from the three classes
mentioned above can then make decisions based upon the differences between
the data on the server and the data within the XML table. Naturally, I
would like to consume the necessary resources and network bandwidth as
infrequently as possible.

The obvious thing to do is instantiate the object that makes this
comparison when the application first opens. But, it occurred to me that
there might be an inialization event within a DLL that would ensure that
this took place even if someone else used the same DLL for another
application in the future.

Another possibility would be to cause each instantiation of each of the
three classes that need this information to check for it themselves, but
then again, I would like to conserve resources and bandwidth.

Thanks for your help.

Peter Bromberg [C# MVP] wrote:
I think you need to clarify what you mean by "Object" when in the next
sentence you say "the classes". In .NET, an "object" is an instance of a
class.
If that's what you mean, it can be done in the contructor.
Peter

Nov 25 '05 #6
Thank you. I come from Delphi and, although I wasn't really clear about
it initially, it was the Initialization feature that I was thinking of.

Fitim Skenderi wrote:
I think one solution is to meka the classes that read the data from the
table as singletons assuming you will only read the data from the table
once, or if you need to get data from the table infrequently then you can
add a method to your singleton to refresh the loaded data from the table.

Fitim Skenderi

p.s. I know that in win32 apps, when you created a DLL in delphi (not COM,
but plain DLL), you had functions that you could implement upon loading the
DLL and upon unloading the DLL , but I haven't come accross anything like
that in C#.
"C Glenn" <no****@domain.com> wrote in message
news:uU**************@TK2MSFTNGP09.phx.gbl...
Three classes within the DLL need to know the status of a specific table
within a database. So I've created a class that, when instantiated,
checks the status of that table, comparing it to the same data stored
locally in an XML table. The objects instantiated from the three classes
mentioned above can then make decisions based upon the differences between
the data on the server and the data within the XML table. Naturally, I
would like to consume the necessary resources and network bandwidth as
infrequently as possible.

The obvious thing to do is instantiate the object that makes this
comparison when the application first opens. But, it occurred to me that
there might be an inialization event within a DLL that would ensure that
this took place even if someone else used the same DLL for another
application in the future.

Another possibility would be to cause each instantiation of each of the
three classes that need this information to check for it themselves, but
then again, I would like to conserve resources and bandwidth.

Thanks for your help.

Peter Bromberg [C# MVP] wrote:
I think you need to clarify what you mean by "Object" when in the next
sentence you say "the classes". In .NET, an "object" is an instance of a
class.
If that's what you mean, it can be done in the contructor.
Peter


Nov 25 '05 #7

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

Similar topics

8
by: Jan van Veldhuizen | last post by:
The UPDATE table FROM syntax is not supported by Oracle. I am looking for a syntax that is understood by both Oracle and SqlServer. Example: Table1: id name city ...
7
by: Byron | last post by:
I have several user controls that have a few methods in common, such LoadFromForm() which populates an object from controls on the form. I want to call that method from the form in which the...
5
by: Filip | last post by:
Hello, (ASP.NET c#) I want to put some common functions into one class and within this class I need to have access to the Session, Request and Response. This class is not page behind file! I...
2
by: Tarren | last post by:
Hi: I am writing a public function as part of a class and wanted to inquire as to what is common practice to the following scenario. I have a class called CARDEALERSHIP i have two classes...
1
by: kmslick | last post by:
Hello all. Not sure which group this problem best relates to, so I'm posting to both with a follow up. I started learning C# and .NET last august for a project for my employer. The project...
6
by: Joseph Geretz | last post by:
I have the following class which I am serializing and passing back and forth between my Web Service application and the client. public class Token : SoapHeader { public string SID; public...
3
by: R.A.F. | last post by:
Hi, From C++ world, i'm used to have a cpp file, where i placed all common functions that i could need within different projects. something like my own "API". i would like to do something...
8
by: Arno R | last post by:
Hi all. When I need to search for pictures, I always have too choose thumbnail-view manually. Is it possible to open the common dialog in thumbnail-view programmatically? Example ?? At the...
6
Markus
by: Markus | last post by:
Things to discuss: Headers What are they? What does PHP have to do with headers? Why can they only be sent before any output? Common causes
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

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.