473,811 Members | 3,736 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MC++ and /MD

Hi,

I am using VS2003.NET. When /clr option is activated, /MT(d) is
automatically chosen (just as said in the doc). Can I changed that to
/MD(d)? Knowing that in VS2005 /MD is chosen by default. And not forgetting
the non-deterministic Mixed DLL problem under VS2003.Net

The situation is the following: I have a native dll, a mixed dll and a .Net
application. The mixed dll interfaces the native dll for .Net (common
senario). One of the methods of a native class returns 2 std::vector 's in
its parameters list which are resized in native code. So the mixed dll has
to declare 2 vectors (with default ctor), send them to the native function
and read back the reuslts in .net arrays.

That worked fine untill I used a different type of vectors (not STL). The
difference I found is that the default ctor of stl vectors in VC7.1 doesn't
allocate memory (doesn't call new) if initiale size is zero (that's good).
But the other type of vectors does that. And when delete is called in the
native code after resizing the vector... Boom!!! _CrtIsValidHeap Pointer
Assertion.

I have to say that the native dll is compiled with /MD and the the mixed dll
is compiled with /MT!!!! So that's it. But I can't compile the native dll
with /MT. And in the first place common heap managment requires /MD
compilation (I think).

So the question (once again) can I compile mixed dll with /MD?

Thanks,
GY

Feb 24 '06 #1
2 1200
Hi,
I am using VS2003.NET. When /clr option is activated, /MT(d) is
automatically chosen (just as said in the doc). Can I changed that to
/MD(d)? Knowing that in VS2005 /MD is chosen by default. And not forgetting
the non-deterministic Mixed DLL problem under VS2003.Net
Yes. I just ran an MFC app compiled with /clr and /MDd and it worked just
fine.
I know MSDN says /MT is automatically chosen, but that does not seem to
happen in my case.

I did the same with an MFC dll, and depends.exe shows clearly that it is
linked against MSVCR71.dll
That worked fine untill I used a different type of vectors (not STL). The
difference I found is that the default ctor of stl vectors in VC7.1 doesn't
allocate memory (doesn't call new) if initiale size is zero (that's good).
But the other type of vectors does that. And when delete is called in the
native code after resizing the vector... Boom!!! _CrtIsValidHeap Pointer
Assertion.
Yes that is a recipe for disaster.
I have to say that the native dll is compiled with /MD and the the mixed dll
is compiled with /MT!!!! So that's it. But I can't compile the native dll
with /MT. And in the first place common heap managment requires /MD
compilation (I think).

So the question (once again) can I compile mixed dll with /MD?


Yes. just compile with /MD and /MDd. It works for me.

--

Kind regards,
Bruno.
br************* *********@hotma il.com
Remove only "_nos_pam"
Feb 24 '06 #2
Hi again

"Bruno van Dooren" <br************ **********@hotm ail.com> a écrit dans le
message de news: 79************* *************** **...icrosof t.com...
Hi,
I am using VS2003.NET. When /clr option is activated, /MT(d) is
automatically chosen (just as said in the doc). Can I changed that to
/MD(d)? Knowing that in VS2005 /MD is chosen by default. And not
forgetting
the non-deterministic Mixed DLL problem under VS2003.Net


Yes. I just ran an MFC app compiled with /clr and /MDd and it worked just
fine.
I know MSDN says /MT is automatically chosen, but that does not seem to
happen in my case.

I did the same with an MFC dll, and depends.exe shows clearly that it is
linked against MSVCR71.dll
That worked fine untill I used a different type of vectors (not STL). The
difference I found is that the default ctor of stl vectors in VC7.1
doesn't
allocate memory (doesn't call new) if initiale size is zero (that's
good).
But the other type of vectors does that. And when delete is called in the
native code after resizing the vector... Boom!!! _CrtIsValidHeap Pointer
Assertion.


Yes that is a recipe for disaster.
I have to say that the native dll is compiled with /MD and the the mixed
dll
is compiled with /MT!!!! So that's it. But I can't compile the native dll
with /MT. And in the first place common heap managment requires /MD
compilation (I think).

So the question (once again) can I compile mixed dll with /MD?


Yes. just compile with /MD and /MDd. It works for me.

--

Kind regards,
Bruno.
br************* *********@hotma il.com
Remove only "_nos_pam"


Thanks for your reply. I think, I have to take this option because I don't
see other solutions but I needed confirmations about it. And you are right
when I choose dynamic link to MFC it switches to /MD (with /clr choosen) (I
don't use MFC so didn't check that)
Thanks again

Best regards
GY

Feb 24 '06 #3

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

Similar topics

0
410
by: Daniel Lidström | last post by:
Hi, I've been trying a long time now to generate some XML using MC++ and XmlSerializer. I have a piece of C# code that produces exactly what I want, but I simply can't get the MC++ code to write the same thing. Below I have included two minimal compilable samples that illustrate my problem. The C# code produces this XML: <?xml version="1.0" encoding="utf-8"?>
1
1644
by: Philip | last post by:
I am trying to return a string from a mc++ method back to an invoking C# module. In the invoking C# module I have the string defined as.... String strString;.... in mc++ the method definition is like.... int function(String *strString, String *strString1....)....etc I am unable to use the "ref" keyword in the C# module when invoking the mc++ method .... it will not compile.
3
1539
by: Philip | last post by:
I am invoking a mc++ method from C# via an unsafe code block. The reason for the unsafe code block is that I am receiving a int as a return parameter. I am invoking the method with a "ref iValue" int parameter.... and in the mc++ code I define "int* iValue" for the same int parameter. As a result I have to place the invoking code in an unsafe code block. Is there not a means to update a int parameter between C# and mc++ without...
2
2520
by: Edward Diener | last post by:
In C++ an overridden virtual function in a derived class must have the exact same signature of the function which is overridden in the base class, except for the return type which may return a pointer or reference to a derived type of the base class's return type. In .NET the overridden virtual function is similar, but an actual parameter of the function can be a derived reference from the base class's reference also. This dichotomy...
2
1914
by: Lev | last post by:
Hi, I have some code that does reflection on an assembly I load. When I try to get the attributes on one of the methods implemented in the assembly, the MC++ version does not return anything. See code below: Object __gc* memberAttributes = info->GetCustomAttributes(__typeof(EntryPointAttribute), false);
0
1217
by: Peter Insley via .NET 247 | last post by:
Hi, have been searching for an answer for this for quite a while,I would be greatfull for any help. We are developing a codebase that of components that we wouldlike to be able to write in MC++ or C# depending on thesituation. These components are accessed through a standard setof interfaces that we have defined in C#. We are using"explicit implementation" for these interfaces as thesecomponents may implement many interfaces, often with...
0
1609
by: Maxwell | last post by:
Hello, I recently completed a MC++ (VS2003) DLL that wraps a non MFC C++ DLL and need to use it in a MC++ Console Application (no forms/guis of any kind just output to console). Trouble is that when I ran it and looked at memory usage (in Windows task manager) it looked as if there was a very slow leak. To isolate the issue:
8
2212
by: WebSnozz | last post by:
I have an application written in C that does a lot of low level stuff. It does a lot of things like casting from void*'s. I want to create a new GUI for it in either C# or MC++, but reuse the existing code. The options I've considered so far: 1. Create a new MC++ GUI project and add the *.c files to them and mark them with pragma unamanged. However, the /clr option does not compile *.c files, so I rename them to *.cpp, and now they...
3
5740
by: Bruno LIVERNAIS | last post by:
Hi, We are currently installing a DB2 V9 ESE on a Linux server (RHEL4U4-x86_64). Installation runs successfully on each node. Database user environment is OK and the instance is well created. To be sure, we've started the database with db2start =successfull. And then shut it down again successfully too. The tricks appears when we switch the hp MC/ServiceGuard (A.11.16 for Linux) package to the other node... the database does not want...
1
1008
by: A. Nonymous | last post by:
First off, I would like to state that I'm using VS.2003 / .NET Framework 1.1 and the MC++ that comes with it. I am stuck with this IDE for the time being as I am supporting some older platforms. So, I'm not going to be migrating to VS.2005 just yet! I have been working on trying to create a DLL written in MC++. It has been a while since I've touched C++ and this is my using MC++. However, I thkink I've been making reasonable progress...
0
9605
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,...
1
10405
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,...
0
10136
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9208
agi2029
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...
1
7671
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 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...
0
6893
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5556
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5697
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3871
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.