Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / February 2005

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
J - 12 Feb 2005 22:21 GMT
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?
Tomas Restrepo \(MVP\) - 13 Feb 2005 01:10 GMT
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.

Signature

Tomas Restrepo
tomasr@mvps.org
http://www.winterdom.com/weblog

J - 18 Feb 2005 06:07 GMT
>Hi J,
>
[quoted text clipped - 3 lines]
>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

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.