473,385 Members | 2,180 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,385 software developers and data experts.

developing managed c++ library

Hi,

I try to develop a .Net class library using managed c++ and have several
problems:

- If I use operator new, I get a linker error because operator new is
missing. Searching the web I found out, that this is a well known
problem which has to do with the initialization of the C/C++ runtime
libraries. The proposed workaround looks not very promissing. But why
would somebody use managed C++ is you could not use common C++ features?

- I develop a library to work with AVI files. If I include windows.h and
wfw.h in different source units, I get a linker error concerning
metadata. Searching the web I found out that the reason seems to be,
that structures with the same name are defined twice with differnt
layout. How could this happen if I use standard include files?

Could somebody help? At the moment, managed C++ makes no sense at all to me.

regards,
Achim
Nov 17 '05 #1
7 1699
Will this class library contain unmanaged code as well? If so, please
read mixed mode DLLs on MSDN.

Normally, you wouldn't get an error for new operator. I don't remember
I have faced with a link failure with new operator.

For the second problem, move windows.h into precompiled header file, or
above the "#include <vfw.h>" line. It shouldn't be related to
meta-data.

What version of MC++ do you use?

Ismail

Nov 17 '05 #2
ismailp wrote:
Will this class library contain unmanaged code as well? If so, please
read mixed mode DLLs on MSDN.
Yes, it will contain unmanaged code. I have read the article on MSDN and
I think I understood the problem.
Normally, you wouldn't get an error for new operator. I don't remember
I have faced with a link failure with new operator.
I changed my code to use Windows functions to alloc/free memory. So
operator new is no problem at the moment.
For the second problem, move windows.h into precompiled header file, or
above the "#include <vfw.h>" line. It shouldn't be related to
meta-data.
I moved both files to stdafx.h and it works now. Still don't understand
what the problem is. Do you know any good books about managed C++?
What version of MC++ do you use?


I use the version which is part of Visual Studio 2003.

Thanks for your fast answer.

regards,
Achim
Nov 17 '05 #3
Achim Domma (Procoders) wrote:
I changed my code to use Windows functions to alloc/free memory. So
operator new is no problem at the moment.

When using new for unmanaged types there should be no problem. Managed code and unmanaged
code are two separate worlds.

I moved both files to stdafx.h and it works now. Still don't understand
what the problem is. Do you know any good books about managed C++?

A good book is "Visual C++ .NET How To Program" by Deitel:

http://vig.prenhall.com/catalog/acad...373774,00.html
Nov 17 '05 #4
I have never encountered with such a problem with new/delete operators
before.

Having Windows.h at precompiled header or prior to other includes is
"must" for some header files those do not include windows.h themselves.
therefore, you need to include this before those headers in the
translation unit. the best way is putting it into precompiled header.

I think I have seen one book, it is MS-Press' but I couldn't recall its
name. Please try to focus on C++/CLI rather than MC++. MC++ will be
deprecated by C++/CLI.

Ismail

Nov 17 '05 #5
ismailp wrote:
Having Windows.h at precompiled header or prior to other includes is
"must" for some header files those do not include windows.h themselves.
therefore, you need to include this before those headers in the
translation unit. the best way is putting it into precompiled header.
I know that Vfw.h needs windows.h to be include first, so I had included
windows.h already. But I included both files in two different cpp files,
which seems to have caused the problem. Moving the includes to stdafx.h
works fine.
I think I have seen one book, it is MS-Press' but I couldn't recall its
name.
"Programming with Managed Extensions for Microsoft Visual C++ .NET
Version 2003" by Richard Grimes looks promissing but is quite expensive.
Please try to focus on C++/CLI rather than MC++. MC++ will be
deprecated by C++/CLI.


Don't know what you mean with C++/CLI and MC++ and what the difference
is!? Is MC++ 'classic' C++ with raw pointers, STL and so on and C++/CLI
is using the .Net framework?
If that's true, I would not give up MC++, because I realy like STL,
templates and so on. I implement low level algorithms and numeric stuff,
which I would like to make available to other .Net languages.

Currently I try to write a library to work with AVI Files. As already
mentioned, I use the Windows Multimedia SDK to read the AVI Files. I
have only seen C# interop examples which work with this API. An managing
raw memory in C# seems to be a pain to me.

How would you work with such raw C APIs?

regards,
Achim
Nov 17 '05 #6
Achim Domma (Procoders) wrote:
Don't know what you mean with C++/CLI and MC++ and what the difference
is!? Is MC++ 'classic' C++ with raw pointers, STL and so on and C++/CLI
is using the .Net framework?

C++/CLI is the descendant of "managed extensions" and will "replace and extend" them in VS
2005.
With VS 2005, C++ becomes the systems programming language of .NET.
Some references:

http://msdn.microsoft.com/msdnmag/is...s/default.aspx

http://pluralsight.com/blogs/hsutter...0/05/2672.aspx

http://blogs.msdn.com/branbray/archi.../07/51007.aspx

http://www.accu.org/conference/prese...keynote%29.pdf
And a page of mine:

http://www23.brinkster.com/noicys/cppcli.htm
If that's true, I would not give up MC++, because I realy like STL,
templates and so on. I implement low level algorithms and numeric stuff,
which I would like to make available to other .Net languages.

VS 2005 will also provide an STL version that will also work for managed types.
Nov 17 '05 #7
Ioannis Vranos wrote:
C++/CLI is the descendant of "managed extensions" and will "replace and
extend" them in VS 2005.

In other words, we can say that it is "managed extensions version 2". Even the draft
standard follows this as version numbering.
Nov 17 '05 #8

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

Similar topics

3
by: New World Order Pigs | last post by:
Sorry if this is the wrong group, but it seems like a good place to start. I have a control, creating a dll written in c#/.net and some unmanaged code in c++ using embedded c++ V3. Yes, it is for...
2
by: paul | last post by:
I have developed an application for pocket pc that requires multiple forms to be open at any one time. The user is able to flick from one to the other, making changes to each as and when necessary...
1
by: Bob Rock | last post by:
Hello, in the last few days I've made my first few attempts at creating mixed C++ managed-unmanaged assemblies and looking aftwerwards with ILDASM at what is visible in those assemblies from a...
2
by: Jacob Cohen | last post by:
Under VC7.1, I am trying to wrap a native-C++ DLL that contains C++ objects in a Managed-C++ class library for use in a C# project. I created and compiled the native DLL under VC7.1 as a Win32...
3
by: mirek | last post by:
Hi, I've got problem building managed class library to wrap unmanaged code. I created managed class library using standard patten: #include "../Unmanaged/Class1.h" //Class1 unmanaged ...
3
by: Tommy Svensson \(InfoGrafix\) | last post by:
I've been instructed to work againt a huge unmanaged C++ API from a C# application. Now, the only way, as I've understood it, is to go the Managed Extensions for C++ way. This means I have to...
13
by: bonk | last post by:
Hello, I am trying to create a dll that internally uses managed types but exposes a plain unmanaged interface. All the managed stuff shall be "wrapped out of sight". So that I would be able to...
7
by: rCs | last post by:
The SEI has published CMU/SEI-2006-TR-006 "Specifications for Managed Strings" and released a "proof-of-concept" implementation of the managed string library. The specification, source code for...
87
by: Robert Seacord | last post by:
The SEI has published CMU/SEI-2006-TR-006 "Specifications for Managed Strings" and released a "proof-of-concept" implementation of the managed string library. The specification, source code for...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.