473,804 Members | 2,085 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2126
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.nos pam>
wrote in message news:O9******** *****@tk2msftng p13.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******** **********@TK2M SFTNGP10.phx.gb l...

"Carl Daniel [VC++ MVP]" <cp************ *************** **@mvps.org.nos pam>
wrote in message news:O9******** *****@tk2msftng p13.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******** *****@TK2MSFTNG P15.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******** **********@TK2M SFTNGP10.phx.gb l...
| >
| > "Carl Daniel [VC++ MVP]"
<cp************ *************** **@mvps.org.nos pam>
| > wrote in message news:O9******** *****@tk2msftng p13.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******** ******@TK2MSFTN GP12.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******** *****@TK2MSFTNG P15.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******** **********@TK2M SFTNGP10.phx.gb l...
| >
| > "Carl Daniel [VC++ MVP]"
<cp************ *************** **@mvps.org.nos pam>
| > wrote in message news:O9******** *****@tk2msftng p13.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
1799
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 object guarantee that it will not be collected by the GC ( by increasing it's refcount or so ), Taking that in mind, looking at the code generated by the compiler I can't see anything taking care of the GC refcount... following is the pinned variable...
9
2593
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 explain it. I have some questions about the instructions for creating a mixed mode DLL in the MSDN topic "Converting Managed Extensions for C++ Projects from Pure Intermediate Language to Mixed Mode" in the "Managed Extensions for C++ Reference"....
8
2000
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 the usage of old style COM, my alternative is to expose my unmanaged interface through the CLI, to achieve that I have created a mixed mode DLL in which my unmanaged class are defined. When referencing the DLL just described in another mixed mode EXE...
7
1696
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 present, and then just disable the API. But we are not even able to give an error message when we start the application without mscoree.dll present. We have tried delay-loading mscoree.dll, but that did not help because the OS loader (at least on...
7
1434
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 "initialisation" routine to cater for any potential "mixed-mode DLL loading problem". Some of our code uses thread-local-storage, and in the DllMain for my mixed-mode assembly I did the appropriate initialisation of the thread-local-storage object on...
8
2325
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 types. The problem: I have a number of mixed-mode functions which I want reuse. These functions revolve around converting a CLR String to a C++ std::string or
0
1415
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 'mixed-mode' assembly. Since a dll of this type provides no normal entry point for C Runtime (CRT) library initialization, I understand that the dll must provide its own exported functions to do this. Thus, from samples I've seen on the web,...
0
1069
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 calls into native code to actually create a TCP/IP socket connection - Test code sets up a listener using the mixed mode assembly to be notified asynchronously (i.e. on a different thread) of events. The listener is held onto by a managed...
3
3760
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 responsed in the remoting group after a week, so I'm throwing a little wider net this time. I have a desktop app (FFx 2.0) developed with Studio 05 that loads assemblies in a separate AppDomains from the primary UI. I'd like to be able to hook up...
0
9716
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9595
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
10359
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
9177
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
7643
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
5536
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...
0
5675
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4314
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
3
3005
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.