I have some legacy code I would like to wrap by some new managed C++
classes, put them all into a DLL and then call the managed classes from a C#
app.
Can anyone recommend me a link with some info about this?
Also, can I statically link my DLL to my C# application or I have to ship
the Managed C++ DLL with the C# exe appllication?
Thanks! 6 4289
"Daniel P." <da******@hotmail.comU> wrote in message
news:Os**************@TK2MSFTNGP09.phx.gbl... I have some legacy code I would like to wrap by some new managed C++ classes, put them all into a DLL and then call the managed classes from a
C# app.
The second part of your question is a gimme. Once you have an MC++ object,
any .Net code in any CLS compliant language can make use of it. Now it is
true that some languages don't support all of the types supported by MC++
(unsigned's as I recall) that is often little more than a nit.
Can anyone recommend me a link with some info about this?
As to the first part of your question you can use "IJW" or it just works so
that a managed C++ member function can call an unmanged C++ function. The
MC++ compiler writes the code to hop the fence between the two environments.
For tips on interoperability take a look at this: http://msdn.microsoft.com/library/de...part2start.asp
and this http://msdn.microsoft.com/library/de...part2start.asp
I like the treatment of interoperability in the book "Essential Guide to
Managed Extensions for C++" (Apress) by Challa and Laksberg of the VC team.
Also, can I statically link my DLL to my C# application or I have to ship the Managed C++ DLL with the C# exe appllication?
Well, if you want to call into a DLL, you'll have to ship it. :-) As to the
linking mechanism used by C# sorry but I don't know what your options are.
That'll probably be answered in the C# group.
Regards,
Will
"William DePalo [MVP VC++]" <wi***********@mvps.org> wrote in
news:Op**************@TK2MSFTNGP12.phx.gbl: Also, can I statically link my DLL to my C# application or I have to ship the Managed C++ DLL with the C# exe appllication?
Well, if you want to call into a DLL, you'll have to ship it. :-) As to the linking mechanism used by C# sorry but I don't know what your options are. That'll probably be answered in the C# group.
Using VS2002/2003, you'll need to ship two physical files. The tools do
not expose a way to link them into one image.
In VS2005, you'll be able to compile your code as .netmodules and link
them into a single-file assembly.
Thanks,
--
Tarek Madkour, Visual C++ Team
This posting is provided "AS IS" with no warranties, and confers
no rights.
Tarek,
IMO the linker (link.exe) refuses to merge pure .netmodules (C#, VB, C++
/clr:safe or /clr:pure) and .netmodules containing native code (C++
/clr)into a single assembly .
So in the case you wrap native code with managed code, you will always need
the separate mixed code assembly, or am I missing something?
Willy.
"Tarek Madkour [MSFT]" <ta****@online.microsoft.com> wrote in message
news:Xn*****************************@207.46.248.16 ... "William DePalo [MVP VC++]" <wi***********@mvps.org> wrote in news:Op**************@TK2MSFTNGP12.phx.gbl:
Also, can I statically link my DLL to my C# application or I have to ship the Managed C++ DLL with the C# exe appllication?
Well, if you want to call into a DLL, you'll have to ship it. :-) As to the linking mechanism used by C# sorry but I don't know what your options are. That'll probably be answered in the C# group.
Using VS2002/2003, you'll need to ship two physical files. The tools do not expose a way to link them into one image.
In VS2005, you'll be able to compile your code as .netmodules and link them into a single-file assembly.
Thanks, -- Tarek Madkour, Visual C++ Team This posting is provided "AS IS" with no warranties, and confers no rights.
Willy Denoyette [MVP] wrote: IMO the linker (link.exe) refuses to merge pure .netmodules (C#, VB, C++ /clr:safe or /clr:pure) and .netmodules containing native code (C++ /clr)into a single assembly . So in the case you wrap native code with managed code, you will always need the separate mixed code assembly, or am I missing something?
If it comes from another language, you'll pass a .netmodule to the linker.
If it comes from C++, you're almost always better off passing object files
rather than .netmodule files to the linker.
Remember that object files can have metadata too, so other compilers can
reference them.
--
Brandon Bray, Visual C++ Compiler http://blogs.msdn.com/branbray/
This posting is provided AS IS with no warranties, and confers no rights.
Brandon,
Thanks for the prompt reply.
I just tried to link a C# netmodule and a mixed mode .netmodule (C++
14.00.40603) and this is what the linker say's... fatal error LNK1302: unable to link .netmodule containing native code
So it looks like we should never use mixed mode .netmodules (using C++) to
be passed to the linker, but instead link the .obj files.
Willy.
"Brandon Bray [MSFT]" <br******@online.microsoft.com> wrote in message
news:ex**************@TK2MSFTNGP09.phx.gbl... Willy Denoyette [MVP] wrote: IMO the linker (link.exe) refuses to merge pure .netmodules (C#, VB, C++ /clr:safe or /clr:pure) and .netmodules containing native code (C++ /clr)into a single assembly . So in the case you wrap native code with managed code, you will always need the separate mixed code assembly, or am I missing something?
If it comes from another language, you'll pass a .netmodule to the linker. If it comes from C++, you're almost always better off passing object files rather than .netmodule files to the linker.
Remember that object files can have metadata too, so other compilers can reference them.
-- Brandon Bray, Visual C++ Compiler http://blogs.msdn.com/branbray/ This posting is provided AS IS with no warranties, and confers no rights.
That is correct.
Ronald Laeremans
Visual C++ team
"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:eV**************@TK2MSFTNGP09.phx.gbl... Brandon,
Thanks for the prompt reply.
I just tried to link a C# netmodule and a mixed mode .netmodule (C++ 14.00.40603) and this is what the linker say's... fatal error LNK1302: unable to link .netmodule containing native code
So it looks like we should never use mixed mode .netmodules (using C++) to be passed to the linker, but instead link the .obj files.
Willy.
"Brandon Bray [MSFT]" <br******@online.microsoft.com> wrote in message news:ex**************@TK2MSFTNGP09.phx.gbl... Willy Denoyette [MVP] wrote: IMO the linker (link.exe) refuses to merge pure .netmodules (C#, VB, C++ /clr:safe or /clr:pure) and .netmodules containing native code (C++ /clr)into a single assembly . So in the case you wrap native code with managed code, you will always need the separate mixed code assembly, or am I missing something?
If it comes from another language, you'll pass a .netmodule to the linker. If it comes from C++, you're almost always better off passing object files rather than .netmodule files to the linker.
Remember that object files can have metadata too, so other compilers can reference them.
-- Brandon Bray, Visual C++ Compiler http://blogs.msdn.com/branbray/ This posting is provided AS IS with no warranties, and confers no rights.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Silver |
last post by:
Hi everyone,
I'm writing a program that has to do them following
main() :
-------
3 objects are declared (two of type A and one of type B)
The function frd_fun is called for two objects (B...
|
by: Dave |
last post by:
Hello all,
Consider this function template definition:
template<typename T>
void foo(T) {}
If foo is never called, this template will never be instantiated.
Now consider this explicit...
|
by: Paul |
last post by:
Hi,
Global operator new and delete are overloaded and I am using stl map
to store pointers, but this code crashes, can some one shed some
light???
Compiler: MS VC++ 6.0
STL: Shipped with...
|
by: Julia |
last post by:
Hi
Please can someone explain this behaviour:
I have a MustInherit Base class and a Derived class that Inherits Base and
Shadows a method in the base class.
If I Dim a variable of type...
|
by: Little |
last post by:
Could someone help me figure out how to put my project together. I
can't get my mind wrapped around the creation of the 4 double Linked
Lists. Thank your for your insight.
1. Create 4 double...
| |
by: TPJ |
last post by:
Help me please, because I really don't get it. I think it's some stupid
mistake I make, but I just can't find it. I have been thinking about it
for three days so far and I still haven't found any...
|
by: Danny Liberty |
last post by:
Hi,
I would like to be able to execute code when a function exits. In c++ I
would have created an object on the stack in the function entry point
and it's destructor would be called when the...
|
by: robert maas, see http://tinyurl.com/uh3t |
last post by:
I'm working on examples of programming in several languages, all
(except PHP) running under CGI so that I can show both the source
files and the actually running of the examples online. The first...
|
by: radhikams |
last post by:
Hi
I want to create a drag drop tool box using javascript... Can anyone please guide me in this regard
Thanks
|
by: Formula |
last post by:
Hello everybody,because I am newbie in python two weeks only but I had programming in another languages but the python take my heart there's 3 kind of arrays Wow now I hate JAVA :) .
I am working...
|
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...
| |
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,...
|
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...
|
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...
|
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,...
|
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...
|
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 ...
|
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...
| |