Click here to Skip to main content
15,894,405 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
Questionnew memory stack for different parameters Pin
electronic_infections26-Aug-06 16:13
electronic_infections26-Aug-06 16:13 
QuestionPrinting Library Pin
Bob X26-Aug-06 11:06
Bob X26-Aug-06 11:06 
AnswerRe: Printing Library Pin
Nish Nishant28-Aug-06 4:47
sitebuilderNish Nishant28-Aug-06 4:47 
QuestionSlow Managed code versus Fast Native code Pin
zenzero26-Aug-06 4:01
zenzero26-Aug-06 4:01 
AnswerRe: Slow Managed code versus Fast Native code Pin
Christian Graus27-Aug-06 3:14
protectorChristian Graus27-Aug-06 3:14 
GeneralRe: Slow Managed code versus Fast Native code Pin
zenzero27-Aug-06 5:04
zenzero27-Aug-06 5:04 
AnswerRe: Slow Managed code versus Fast Native code Pin
Nish Nishant28-Aug-06 4:46
sitebuilderNish Nishant28-Aug-06 4:46 
GeneralRe: Slow Managed code versus Fast Native code Pin
zenzero28-Aug-06 7:18
zenzero28-Aug-06 7:18 
Hi Nish,

Thanks for your thoughts. Actually both the 'native' and managed versions are compiled with the /clr:pure option, so both are compiled to MSIL. The class structure of the native version is like this:

<br />
class Fractal<br />
{<br />
// blah blah<br />
<br />
public:<br />
virtual int DwellTest(int) = 0;<br />
};<br />
<br />
<br />
class Mandelbrot : public Fractal<br />
{<br />
// blah blah<br />
<br />
public:<br />
int DwellTest(int, int);<br />
};<br />
<br />
<br />
int Mandelbrot::DwellTest(int X, int Y)<br />
{<br />
	// Calculate Cx and Cy from the form coordinates<br />
InitParams(X, Y);<br />
<br />
	double Zx2;<br />
	double Zy2;<br />
<br />
	// Perform the test, Z = Z^2 + C, on the point coordinates<br />
	for(TestCount = 0; TestCount < MaxIters; TestCount++)<br />
	{<br />
		Zx2 = Zx * Zx;<br />
		Zy2 = Zy * Zy;<br />
<br />
		if(Zx2 + Zy2 > Bailout)<br />
		{ break; }<br />
<br />
		Zy = 2.0 * Zx * Zy + Cy;<br />
		Zx = Zx2 - Zy2 + Cx;<br />
	}<br />
<br />
	// Update fractal pixel state<br />
	UpdateState(X, Y);<br />
	return TestCount;<br />
}<br />

For the managed version I changed how the classes were declared.
<br />
public ref class Fractal abstract<br />
{<br />
// Blah blah<br />
<br />
public:<br />
	virtual int DwellTest(int, int) = 0;<br />
};<br />
<br />
<br />
public ref class Mandelbrot : public Fractal<br />
{<br />
// Blah blah<br />
<br />
public:		<br />
	virtual int DwellTest(int, int) override;<br />
};<br />


That probably doesn't help very much! Smile | :)

The reason I was trying to do this is because I wanted to compile it has a class library so that I can use it Mono and create a new platform independent front-end in C# and Mono's implementation of Forms. Unfortunately Mono does not yet support C++/CLI and Micosoft's Windows.Forms is not portable. My other possible solution to the problem was to wrap the native code in C++/CLI but I do not know how to do that for an abstract base class, hence my other question further up Smile | :)

I will probably wait for the Mono team to support C++/CLI Smile | :)
Questionstd::wstring by ref Pin
wb24-Aug-06 23:52
wb24-Aug-06 23:52 
Question0D 0A terminated string to 00 terminated string Pin
samkook24-Aug-06 13:20
samkook24-Aug-06 13:20 
QuestionArray handling problems: Pin
luhfluh24-Aug-06 9:43
luhfluh24-Aug-06 9:43 
AnswerRe: Array handling problems: Pin
Christian Graus24-Aug-06 14:21
protectorChristian Graus24-Aug-06 14:21 
GeneralRe: Array handling problems: Pin
luhfluh25-Aug-06 0:59
luhfluh25-Aug-06 0:59 
QuestionHow to display Exception after the Form is loaded Pin
mmhu24-Aug-06 4:59
mmhu24-Aug-06 4:59 
AnswerRe: How to display Exception after the Form is loaded Pin
Nish Nishant25-Aug-06 2:59
sitebuilderNish Nishant25-Aug-06 2:59 
GeneralRe: How to display Exception after the Form is loaded Pin
mmhu26-Aug-06 13:26
mmhu26-Aug-06 13:26 
QuestionSetting toolbox tab programatically Pin
Edward Diener24-Aug-06 2:22
Edward Diener24-Aug-06 2:22 
QuestionInvisible text in Messagebox [modified] Pin
dawei.code23-Aug-06 0:02
dawei.code23-Aug-06 0:02 
AnswerRe: Invisible text in Messagebox Pin
Nish Nishant24-Aug-06 11:22
sitebuilderNish Nishant24-Aug-06 11:22 
GeneralRe: Invisible text in Messagebox Pin
dawei.code25-Aug-06 2:04
dawei.code25-Aug-06 2:04 
QuestionNon-managed (unsafe) code impersonation Pin
Ray Cassick22-Aug-06 9:00
Ray Cassick22-Aug-06 9:00 
AnswerRe: Non-managed (unsafe) code impersonation Pin
Nish Nishant23-Aug-06 6:45
sitebuilderNish Nishant23-Aug-06 6:45 
QuestionHow to pass a SortedList from C# to MC++ [modified] Pin
AbinThomas21-Aug-06 0:29
AbinThomas21-Aug-06 0:29 
AnswerRe: How to pass a SortedList from C# to MC++ Pin
Jun Du23-Aug-06 5:16
Jun Du23-Aug-06 5:16 
GeneralRe: How to pass a SortedList from C# to MC++ Pin
AbinThomas23-Aug-06 18:38
AbinThomas23-Aug-06 18:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.