473,399 Members | 3,832 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,399 software developers and data experts.

Managed code within unmanaged code ?

Hi,

Can I mix my managed code within my unmanaged code?

Just for instance, I have a socket class that is managed code. It is
include in my unmanaged VC++ project and it compile.

The point is, when I want to instantiate my class, I still get this error:
fatal error C1190: managed targeted code requires '#using
<mscorlib.dll>' and '/clr' option

But this is already set in my class (right-click file properties).

At this time, only the socket class properties is configure to have the
/clr and mscorlib.dll. Should it be done for all the unmanaged project?

Any idea?

Thank you very much.

Marty
Nov 17 '05 #1
3 1257
"Marty" <xm******@hotmail.com> wrote in message
news:bMlRd.74885$L_3.20142@clgrps13...
Can I mix my managed code within my unmanaged code?
Yes, you have a couple of options.
Just for instance, I have a socket class that is managed code. It is
include in my unmanaged VC++ project and it compile.

The point is, when I want to instantiate my class, I still get this error:
fatal error C1190: managed targeted code requires '#using <mscorlib.dll>'
and '/clr' option


The simplest thing to do is to set your unmanaged prooject properties so
that it compiles with the /CLR switch:

Project->Properties

from the menu

Click on the Configuration Properties folder and select General and then
scroll down to use Managed Extensions in the right pane.

Then in a module where you want to use both modes, use this to separate the
managed and unmanaged functions

#using <mscorlib.dll>

#pragma unmanaged

Nov 17 '05 #2
Yes, you can find the answer of your question in QStat Sample at MSDN
Library.

"Marty" <xm******@hotmail.com> escribió en el mensaje
news:bMlRd.74885$L_3.20142@clgrps13...
Hi,

Can I mix my managed code within my unmanaged code?

Just for instance, I have a socket class that is managed code. It is
include in my unmanaged VC++ project and it compile.

The point is, when I want to instantiate my class, I still get this error:
fatal error C1190: managed targeted code requires '#using
<mscorlib.dll>' and '/clr' option

But this is already set in my class (right-click file properties).

At this time, only the socket class properties is configure to have the
/clr and mscorlib.dll. Should it be done for all the unmanaged project?

Any idea?

Thank you very much.

Marty

Nov 17 '05 #3
Thanks for the information guys

Have a nice day.

Marty

OxyGen wrote:
Yes, you can find the answer of your question in QStat Sample at MSDN
Library.

"Marty" <xm******@hotmail.com> escribió en el mensaje
news:bMlRd.74885$L_3.20142@clgrps13...
Hi,

Can I mix my managed code within my unmanaged code?

Just for instance, I have a socket class that is managed code. It is
include in my unmanaged VC++ project and it compile.

The point is, when I want to instantiate my class, I still get this error:
fatal error C1190: managed targeted code requires '#using
<mscorlib.dll>' and '/clr' option

But this is already set in my class (right-click file properties).

At this time, only the socket class properties is configure to have the
/clr and mscorlib.dll. Should it be done for all the unmanaged project?

Any idea?

Thank you very much.

Marty


Nov 17 '05 #4

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

Similar topics

0
by: Stephen Horne | last post by:
I've only very recently started with .NET, and need to use some existing container libraries in new code. I'd like to minimise the amount of porting, but of course these containers are not designed...
2
by: asanford | last post by:
We use StackWalk(StackWalk64) from dbghelp.dll to walk our callstacksas needed, using the various Sym* methods (SymGetSymFromAddr, SymGetLineFromAddr) to resolve source file, function name, and...
4
by: repstat | last post by:
Hi I have a project which is going to be doing some string manipulation which needs to be pretty fast. The user interface is going to be written in C#. I am going to write the string handling...
2
by: The unProfessional | last post by:
In my current project (my first project using vc w/ managed extensions), I'm directly #using <mscorlib.dll>, so it's necessary for me to use the __nogc and __gc constructs when defining classes or...
4
by: Fredrik Wahlgren | last post by:
hi I have apet aproject that i created a long time ago and I now want to make part of it managed. This is a dtabase application s I want to create a class in which I wrap ADO.NET. The design is...
9
by: Herby | last post by:
Is possible to have a managed method within a Native(un-managed) class within a \clr project? E.g. class myClass { public: #pragma managed void myMethod(void);
4
by: devmentee | last post by:
I want to write a managed wrapper( kind of proxy) which will call into unmanaged C++ code. I've got a general idea and have read some articles on how to do it. But I cannot find any information on...
9
by: Amit Dedhia | last post by:
Hi All I have a VC++ 2005 MFC application with all classes defined as unmanaged classes. I want to write my application data in xml format. Since ADO.NET has buit in functions available for...
3
by: Klaus | last post by:
Hi, I have an existing VC 6 MFC application which communicates asynchronly with a VC 2005 managed code dll. I use an unmanaged base class with virtual functions to access methods in the MFC...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...

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.