473,569 Members | 2,522 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Subtle diffs between C++IJW, unmanaged, __nogc, etc

J
Compiling a straight C++ module under VC++ 7 would seem to autogen an
'IJW' type .NET module, even if the module has standard VC++ syntax.

I'm assuming that the 'unmanaged' flag would have no further affect on
this code. Nor would __nogc. Correct? Or are there subtle further
differences?

Are there recommended references that sort this type of thing out in
precise detail?

Nov 17 '05 #1
2 1287
Hi J,
Compiling a straight C++ module under VC++ 7 would seem to autogen an
'IJW' type .NET module, even if the module has standard VC++ syntax.
Only if you compile with /clr. Unless you enable that, the compiler will
produce straight x86 machine code, no .NET anywhere, just as with VC 6.
I'm assuming that the 'unmanaged' flag would have no further affect on
this code. Nor would __nogc. Correct? Or are there subtle further
differences?


What unmanaged flag? you mean #pragma unmanaged? That is only useful to
force methods to be compiled as x86 code in a module compiled with /clr.
Once you enable /clr, all methods (regardless of whether they are global
methods or class members) get compiled as MSIL (but classes themselves
remain unmanaged types), unless they use a few special idioms (variable arg
methods, inline asm code, etc.) that force the compiler to generate them as
unmanaged code anyway, or you use #pragma unmanaged on them

The __nogc thing, whether it causes semantic changes, depends a lot on what
context you are using it, but, for the most part, in your example it should
cause non.

--
Tomas Restrepo
to****@mvps.org
http://www.winterdom.com/weblog
Nov 17 '05 #2
J
On Sat, 12 Feb 2005 20:10:59 -0500, "Tomas Restrepo \(MVP\)"
<to****@mvps.or g> wrote:
Hi J,
Compiling a straight C++ module under VC++ 7 would seem to autogen an
'IJW' type .NET module, even if the module has standard VC++ syntax.
Only if you compile with /clr. Unless you enable that, the compiler will
produce straight x86 machine code, no .NET anywhere, just as with VC 6.


Yes, that's what I meant.
I'm assuming that the 'unmanaged' flag would have no further affect on
this code. Nor would __nogc. Correct? Or are there subtle further
differences?


What unmanaged flag? you mean #pragma unmanaged? That is only useful to
force methods to be compiled as x86 code in a module compiled with /clr.


Yes, #pragma. I should have been more specific. It brings up an
interesting point though. I'm trying to fit code together between
managed, unmanaged and a legacy DLL (unmanaged, of course).
It never occurred to me to compile the middle level without the
#pragma unmanaged flag, as I thought it would be a more reliable
bridge down to the old DLL. On the other hand, maybe it's not
as reliable in getting back to the unmanaged code.
Once you enable /clr, all methods (regardless of whether they are global
methods or class members) get compiled as MSIL (but classes themselves
remain unmanaged types), unless they use a few special idioms (variable arg
methods, inline asm code, etc.) that force the compiler to generate them as
unmanaged code anyway, or you use #pragma unmanaged on them
See, this is the kind of stuff I'm looking for to fill in gaps in
vague specs. It's tough to get a good intuitive feel for this.
The __nogc thing, whether it causes semantic changes, depends a lot on what
context you are using it, but, for the most part, in your example it should
cause non.


Non?

Thanks
Nov 17 '05 #3

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

Similar topics

9
18028
by: Andrew Cumming | last post by:
I am having trouble using Platform Invoke to call C++ DLLs from C# windows applications. The DLLs seem to load, but I get run-time errors to the effect that the named entry points cannot be found. The DLLs are compiled in MS Visual C++ Version 6 and the C# applications are written in MS VS C#.NET 2003. I am using the specifier...
4
2511
by: 0to60 | last post by:
I'm trying to create a .dll with VS.NET 2003 Architect that contains a math computational component. I need the guts of the thing to be in native code, as performance is key for that part. But, I need a .net wrapper because this "calculator" is actually a component used by an enterprise app written entirely in .net. What I want to do is...
3
5358
by: Austin Ehlers | last post by:
(I apologize if this is a fairly trivial question, but I mostly use C#, not MC++.) Problem: I've got an unmanaged DLL (and the LIB file), that exports a bunch of static functions. I'd like to be able to wrap this with a __gc class, and then access it from C#. All of the examples I've seen are based upon wrapping unmanaged code (H and CPP...
0
1146
by: ajerijian | last post by:
Hi all, My apologies for posting this message into the wrong newsgroup. I'm reposting it here since it's more appropriate. I am attempting to export an unmanaged (__nogc) C++ class from a class library into an C++ application compiled using the CLR. Within the class library, I have declared the class as follows: __nogc class...
7
1855
by: Lev | last post by:
Hi, I have an unmanaged pointer to a class that I want to hold in a managed class. I pass the pointer (from unmanaged code) in the constructor of the managed class, and at that point it has value. It is stored in a member variable in my managed class declared as MyObj __nogc* pMyObj. When I try to retrieve it later, using a function...
5
1722
by: Andrew | last post by:
I want to use a managed c++ class from an unmanaged class. Here is my code: // *** Unmanaged Code // .h file class UnmanagedClass { public: // Other stuff here
0
2921
by: Roland | last post by:
Hi, ultimately I want to call some unmanaged C++ class that contains some DirectShow code of mine from my C# classes, but for the time being I'd be happy if I could get this to build! I have read the other topics on the same problem here on the groups but haven't found the solution to my problem yet. I have written a managed C++ wrapper...
1
1471
by: slugster | last post by:
Hi, i originally posted this via another portal, but after giving it time to propagate it still hasn't shown up. My apologies for the multiposting. This might be a very simple question, but i am still getting my head round this stuff. I have a mixed mode dll. In it i have a managed class with a function, i want to call that function...
5
2393
by: Andy | last post by:
I'm having trouble accessing an unmanaged long from a managed class in VC++.NET When I do, the contents of the variable seem to be mangled. If I access the same variable byte-by-byte, I get the correct value. Regardless what I set the variable to, the value that is returned for a long is always the same value. What's going on...can anyone...
0
7701
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...
0
7924
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8130
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7677
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...
0
7979
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5514
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...
0
5219
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...
1
1223
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
940
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...

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.