473,394 Members | 1,738 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.

Appdomains and mixed mode assembly

Dear all,
I have a global variable in the native code.
I was assuming that I create a IJW CLI wrapper class and create an instance
of this class in other appdomain, then the global variables will not be
shared between to. But it is apparently not the case.
Any ideas how I could separate the globals, when 2 instanes of native code
must run in parallel.
Thanks a lot,
Boni
Feb 13 '06 #1
7 2085
Boni wrote:
Dear all,
I have a global variable in the native code.
I was assuming that I create a IJW CLI wrapper class and create an
instance of this class in other appdomain, then the global variables
will not be shared between to. But it is apparently not the case.
Any ideas how I could separate the globals, when 2 instanes of native
code must run in parallel.


They have to be non-global. Static variables in managed code are allocated
in special per-appdomain sections that are replicated for each new
appdomain. Not so for native static variables.

-cd
Feb 13 '06 #2
Hi Carl,
They have to be non-global. Static variables in managed code are
allocated in special per-appdomain sections that are replicated for each
new appdomain. Not so for native static variables.

Unfortunately I have no control above native code, I must just wrap it and
let it start from managed code. And this native code has many statics.
So it seems that only work around is to start multiple processes instead of
app domains. Also drawbacks are big.
Thanks a lot,
Boni
Feb 13 '06 #3

"Carl Daniel [VC++ MVP]" <cp*****************************@mvps.org.nospam >
wrote in message news:O9*************@tk2msftngp13.phx.gbl...
| Boni wrote:
| > Dear all,
| > I have a global variable in the native code.
| > I was assuming that I create a IJW CLI wrapper class and create an
| > instance of this class in other appdomain, then the global variables
| > will not be shared between to. But it is apparently not the case.
| > Any ideas how I could separate the globals, when 2 instanes of native
| > code must run in parallel.
|
| They have to be non-global. Static variables in managed code are
allocated
| in special per-appdomain sections that are replicated for each new
| appdomain. Not so for native static variables.
|
| -cd
|

True for pure managed assemblies but not for native code global statics,
these have process scope not domain scope.

Willy.
|
Feb 13 '06 #4
Willy, I got it already. What is the solution?
How can I create a class instance in separate process?
"Willy Denoyette [MVP]" <wi*************@telenet.be> schrieb im Newsbeitrag
news:%2******************@TK2MSFTNGP10.phx.gbl...

"Carl Daniel [VC++ MVP]" <cp*****************************@mvps.org.nospam >
wrote in message news:O9*************@tk2msftngp13.phx.gbl...
| Boni wrote:
| > Dear all,
| > I have a global variable in the native code.
| > I was assuming that I create a IJW CLI wrapper class and create an
| > instance of this class in other appdomain, then the global variables
| > will not be shared between to. But it is apparently not the case.
| > Any ideas how I could separate the globals, when 2 instanes of native
| > code must run in parallel.
|
| They have to be non-global. Static variables in managed code are
allocated
| in special per-appdomain sections that are replicated for each new
| appdomain. Not so for native static variables.
|
| -cd
|

True for pure managed assemblies but not for native code global statics,
these have process scope not domain scope.

Willy.
|

Feb 13 '06 #5
Remoting , DCOM etc... . But why don't you try to get rid of this global
variable?

Willy.
"Boni" <oilia@nospam> wrote in message
news:Op*************@TK2MSFTNGP15.phx.gbl...
| Willy, I got it already. What is the solution?
| How can I create a class instance in separate process?
| "Willy Denoyette [MVP]" <wi*************@telenet.be> schrieb im
Newsbeitrag
| news:%2******************@TK2MSFTNGP10.phx.gbl...
| >
| > "Carl Daniel [VC++ MVP]"
<cp*****************************@mvps.org.nospam >
| > wrote in message news:O9*************@tk2msftngp13.phx.gbl...
| > | Boni wrote:
| > | > Dear all,
| > | > I have a global variable in the native code.
| > | > I was assuming that I create a IJW CLI wrapper class and create an
| > | > instance of this class in other appdomain, then the global variables
| > | > will not be shared between to. But it is apparently not the case.
| > | > Any ideas how I could separate the globals, when 2 instanes of
native
| > | > code must run in parallel.
| > |
| > | They have to be non-global. Static variables in managed code are
| > allocated
| > | in special per-appdomain sections that are replicated for each new
| > | appdomain. Not so for native static variables.
| > |
| > | -cd
| > |
| >
| > True for pure managed assemblies but not for native code global statics,
| > these have process scope not domain scope.
| >
| > Willy.
| > |
| >
| >
|
|
Feb 13 '06 #6
Hi Willy,
First of all thanks a lot.
The libruary is not from me, and it can't be changed (unfortunately).
Do you know a good starting resource on remoting, DCOM etc?
BTW will remoting work on mixed mode assemblies? AFAIK it will fail, because
native stuff can't be sent over remoting.
Am I right?

"Willy Denoyette [MVP]" <wi*************@telenet.be> schrieb im Newsbeitrag
news:uP**************@TK2MSFTNGP12.phx.gbl...
Remoting , DCOM etc... . But why don't you try to get rid of this global
variable?

Willy.
"Boni" <oilia@nospam> wrote in message
news:Op*************@TK2MSFTNGP15.phx.gbl...
| Willy, I got it already. What is the solution?
| How can I create a class instance in separate process?
| "Willy Denoyette [MVP]" <wi*************@telenet.be> schrieb im
Newsbeitrag
| news:%2******************@TK2MSFTNGP10.phx.gbl...
| >
| > "Carl Daniel [VC++ MVP]"
<cp*****************************@mvps.org.nospam >
| > wrote in message news:O9*************@tk2msftngp13.phx.gbl...
| > | Boni wrote:
| > | > Dear all,
| > | > I have a global variable in the native code.
| > | > I was assuming that I create a IJW CLI wrapper class and create an
| > | > instance of this class in other appdomain, then the global
variables
| > | > will not be shared between to. But it is apparently not the case.
| > | > Any ideas how I could separate the globals, when 2 instanes of
native
| > | > code must run in parallel.
| > |
| > | They have to be non-global. Static variables in managed code are
| > allocated
| > | in special per-appdomain sections that are replicated for each new
| > | appdomain. Not so for native static variables.
| > |
| > | -cd
| > |
| >
| > True for pure managed assemblies but not for native code global
statics,
| > these have process scope not domain scope.
| >
| > Willy.
| > |
| >
| >
|
|

Feb 13 '06 #7
Willy Denoyette [MVP] wrote:
"Carl Daniel [VC++ MVP]"
They have to be non-global. Static variables in managed code are
allocated in special per-appdomain sections that are replicated for
each new appdomain. Not so for native static variables.


True for pure managed assemblies but not for native code global
statics, these have process scope not domain scope.


I'm not sure what you were trying to add with this reply. It looks to me
like you merely repeated what I said. Is there some other subtlety you were
trying to clarify?

-cd
Feb 14 '06 #8

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

Similar topics

3
by: Nadav | last post by:
Hi, I am writing a mixed mode application, I have a mixed mode Assembly manipulating a managed byte array, to access this array in unmanaged code I '__pin' the array, As I understand, pining an...
9
by: Edward Diener | last post by:
I received no answers about this the first time I posted, so I will try again. My inability to decipher an MSDN topic may find others who have the same inability and someone who can decipher and...
8
by: Nadav | last post by:
Hi, I am writing a performence critical application, this require me to stick to unmanaged C++ as performance is much better using unmanaged C++ ( about 33% better ), Still, I am trying to avoid...
7
by: Staale L. Hansen | last post by:
We have an application which uses some mixed-mode code to expose a .NET 1.1 managed API. Only the necessary files are compiled with /clr. We want to be able to load the application without .NET...
7
by: Kevin Frey | last post by:
Using .NET 1.1. We have a mixed-mode assembly written in Managed C++ that we are using from an ASP.NET application that has been coded using C#. The mixed-mode assembly has its own...
8
by: Edward Diener | last post by:
By reuse, I mean a function in an assembly which is called in another assembly. By a mixed-mode function I mean a function whose signature has one or more CLR types and one or more non-CLR...
0
by: Russ Barrett | last post by:
Hello, I'm new to ASP.Net and I'm trying to interface an ASP.Net (C#) application to functionality resident in a C++ static lib. From posts I've seen around I understand this requires creation of a...
0
by: draskin | last post by:
Hello, I have the following situation: - Text.exe creates a new AppDomain - Test.exe loads mixed mode assembly in a non-default AppDomain - Test.exe calls connect to a TCP/IP socket server which...
3
by: | last post by:
If this is simple, forgive my ignorance, but I'm coming from the CompactFramework where we don't use AppDomains. I did a fair bit of archive searching and couldn't find an answer and I got no...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.