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 3 1269
"Marty" <xm******@hotma il.com> wrote in message
news:bMlRd.7488 5$L_3.20142@clg rps13... 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
Yes, you can find the answer of your question in QStat Sample at MSDN
Library.
"Marty" <xm******@hotma il.com> escribió en el mensaje
news:bMlRd.7488 5$L_3.20142@clg rps13... 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
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******@hotma il.com> escribió en el mensaje news:bMlRd.7488 5$L_3.20142@clg rps13...
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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 to
work in a .NET managed way. They make extensive use of pointer
arithmetic, placement new and various other techniques that are
obviously incompatible with managed code.
If possible, I'd like to find a way of storing managed objects within...
|
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 source line number for each frame. This works fine
for unmanaged code, but when we have a call stack that goes into or
through some managed code, we cannot resolve any info for the managed
frames - we can however, get all the information for the...
|
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 functions in a C++ DLL.
My first question is, if I insert a C++ project into my C# solution, how
will VS.NET know that I want it to be unmanaged code? I intend to be calling
the DLLs functions using DllImport. I've heard that you can have unmanaged...
|
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 structs.
The concept seems simple... some classes are managed, some aren't. I'm just
wondering if there are any major caveats here... anything I need to take
into consideration or keep an eye on.
I'm only using managed extensions so I can...
|
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 such that when I make a query, I want
to send each string from the query to unmanaged code. In other words, I
simply want to call an unmanaged function from within a managed class within
the same dll.
Is there anything in particular that I...
| |
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);
|
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 some specific things..
for example, I have unmanaged class
class Foo
{
void SetData(std::map<std::string, std::stringsvalue);
};
|
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 this, I want to use
it. Is it possible to call Managed class functions from Unmanaged
class? How to do it?
I did something like this.
I declared a managed class (in C++ CLI) called as MyManagedClass whose
|
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 application.
Furthermore, I use a pointer to an unmanaged function to jump back into the
managed dll.
The managed part is basically a remoting enhancement which asynchronly
|
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,...
|
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.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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,...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |