By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,098 Members | 1,918 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,098 IT Pros & Developers. It's quick & easy.

Share dll object

P: n/a
anybody knows how to share the dll between the process? I know there is a way
to set the #pragma data_seg in the visual studio 6.0 C++, that can make the
dll can be shared between the multiple processes. but how to do it in .net?

--
ISAMUSETU
Nov 17 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Remoting?
What exactly do you want to share?

--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

"isamusetu" <is*******@discussions.microsoft.com> wrote in message
news:BF**********************************@microsof t.com...
anybody knows how to share the dll between the process? I know there is a
way
to set the #pragma data_seg in the visual studio 6.0 C++, that can make
the
dll can be shared between the multiple processes. but how to do it in
.net?

--
ISAMUSETU

Nov 17 '05 #2

P: n/a

"isamusetu" <is*******@discussions.microsoft.com> wrote in message
news:BF**********************************@microsof t.com...
anybody knows how to share the dll between the process? I know there is a
way
to set the #pragma data_seg in the visual studio 6.0 C++, that can make
the
dll can be shared between the multiple processes. but how to do it in
.net?

--
ISAMUSETU


What exactly do you need to share?
#pragma data_seg does not share a DLL!, it shares the "named" data segment
only, this option is not available (not needed) for managed code.
If it's your intention to share raw data your best option is memory mapped
files, when you need to "share" object instances take a look at remoting.

Willy.
Nov 17 '05 #3

P: n/a
Thanks, what I need is share the object between the process, because we are
thinking to make a project which will has 3 layers(web server, app server,
database server), for example, the app server will incharge the database
access, if the database connection object can be shared between the processes
on the app server, this object dont need create and disposed time to time.

Thats my target, and you said the remoting can implement it, I see. is there
any other way to do like remoting(more simple more better)

Warm regards.
--
ISAMUSETU
"Willy Denoyette [MVP]" wrote:

"isamusetu" <is*******@discussions.microsoft.com> wrote in message
news:BF**********************************@microsof t.com...
anybody knows how to share the dll between the process? I know there is a
way
to set the #pragma data_seg in the visual studio 6.0 C++, that can make
the
dll can be shared between the multiple processes. but how to do it in
.net?

--
ISAMUSETU


What exactly do you need to share?
#pragma data_seg does not share a DLL!, it shares the "named" data segment
only, this option is not available (not needed) for managed code.
If it's your intention to share raw data your best option is memory mapped
files, when you need to "share" object instances take a look at remoting.

Willy.

Nov 17 '05 #4

P: n/a
But why would you share a Database connection object if only the app server
is in charge of the DB access?

Willy.

"isamusetu" <is*******@discussions.microsoft.com> wrote in message
news:92**********************************@microsof t.com...
Thanks, what I need is share the object between the process, because we
are
thinking to make a project which will has 3 layers(web server, app server,
database server), for example, the app server will incharge the database
access, if the database connection object can be shared between the
processes
on the app server, this object dont need create and disposed time to time.

Thats my target, and you said the remoting can implement it, I see. is
there
any other way to do like remoting(more simple more better)

Warm regards.
--
ISAMUSETU
"Willy Denoyette [MVP]" wrote:

"isamusetu" <is*******@discussions.microsoft.com> wrote in message
news:BF**********************************@microsof t.com...
> anybody knows how to share the dll between the process? I know there is
> a
> way
> to set the #pragma data_seg in the visual studio 6.0 C++, that can make
> the
> dll can be shared between the multiple processes. but how to do it in
> .net?
>
> --
> ISAMUSETU


What exactly do you need to share?
#pragma data_seg does not share a DLL!, it shares the "named" data
segment
only, this option is not available (not needed) for managed code.
If it's your intention to share raw data your best option is memory
mapped
files, when you need to "share" object instances take a look at remoting.

Willy.

Nov 17 '05 #5

P: n/a
if the database connection object is always in the memory, I don't need to
new() and dispose() it time to time right? if there isn't, when the module A
startup, A should new a object and dispose it when A exit, and module B
startup, B should new a object and dispose it same as A did, that will take
the cpu time.

the database connection object is just a sample here, if we hava some dll
can be used for lots of modules, if those objects in the dlls can be created
only once, I think the system will be faster.

Sure I know some object can not be shared between the different processes,
but would you tell me is there the way to implement this function in the .net?

--
ISAMUSETU
"Willy Denoyette [MVP]" wrote:
But why would you share a Database connection object if only the app server
is in charge of the DB access?

Willy.

"isamusetu" <is*******@discussions.microsoft.com> wrote in message
news:92**********************************@microsof t.com...
Thanks, what I need is share the object between the process, because we
are
thinking to make a project which will has 3 layers(web server, app server,
database server), for example, the app server will incharge the database
access, if the database connection object can be shared between the
processes
on the app server, this object dont need create and disposed time to time.

Thats my target, and you said the remoting can implement it, I see. is
there
any other way to do like remoting(more simple more better)

Warm regards.
--
ISAMUSETU
"Willy Denoyette [MVP]" wrote:

"isamusetu" <is*******@discussions.microsoft.com> wrote in message
news:BF**********************************@microsof t.com...
> anybody knows how to share the dll between the process? I know there is
> a
> way
> to set the #pragma data_seg in the visual studio 6.0 C++, that can make
> the
> dll can be shared between the multiple processes. but how to do it in
> .net?
>
> --
> ISAMUSETU

What exactly do you need to share?
#pragma data_seg does not share a DLL!, it shares the "named" data
segment
only, this option is not available (not needed) for managed code.
If it's your intention to share raw data your best option is memory
mapped
files, when you need to "share" object instances take a look at remoting.

Willy.


Nov 17 '05 #6

P: n/a
Thank you, you can see what I want to do below.

--
ISAMUSETU
"Miha Markic [MVP C#]" wrote:
Remoting?
What exactly do you want to share?

--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

"isamusetu" <is*******@discussions.microsoft.com> wrote in message
news:BF**********************************@microsof t.com...
anybody knows how to share the dll between the process? I know there is a
way
to set the #pragma data_seg in the visual studio 6.0 C++, that can make
the
dll can be shared between the multiple processes. but how to do it in
.net?

--
ISAMUSETU


Nov 17 '05 #7

P: n/a
Hi,

"isamusetu" <is*******@discussions.microsoft.com> wrote in message
news:FA**********************************@microsof t.com...
if the database connection object is always in the memory, I don't need to
new() and dispose() it time to time right? if there isn't, when the module
A
startup, A should new a object and dispose it when A exit, and module B
startup, B should new a object and dispose it same as A did, that will
take
the cpu time.
It is a bad example. You should use connection object per thread and it
should be opened as late as possible and closed asap.
Sharing such object doesn't make sense and performace will go down to the
ground.

the database connection object is just a sample here, if we hava some dll
can be used for lots of modules, if those objects in the dlls can be
created
only once, I think the system will be faster.
No it won't. Generaly speaking you are better off creating each object in
the application itself - otherwise you'll loose time with remoting (it costs
you) and also you'll have to implement locking mechanism which might be a
bottleneck and again, you can loose much time here. You should consider
sharing objects in rare cases.
Another problem is that if you implement remoting your shared objects have
to live in a separata process (which will consume resources and cpu cylces,
too).

Sure I know some object can not be shared between the different processes,
but would you tell me is there the way to implement this function in the
.net?


So, the bottom line is - avoid sharing unless really necessary.

--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
Nov 17 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.