Internal Compiler Error

  • Thread starter Thread starter Rajesh.S
  • Start date Start date
R

Rajesh.S

some more info...
-----Original Message-----
I built a VC++.Net project as a dll and
included it as a reference in a c# project.
When I call a c++ function from the csharp
project I get internal compiler error.

The function in the c++ dll got the signature
void __gc *CInitialContext::Lookup(char *)
throw (CJMSException*)

The function was called in csharp as

CInitialContext m_ic = new CInitialContext();
String m_tcfName = "primaryTCF";
 
Which version of Visual Studio are you using? Have you installed any of the
service packs?
 
I am using Visual Studio 2002 with
Microsoft .Net framework 1.0
I dont have any service packs installed.
Do you think that is the reason for the error?
If so can you please post what service pack(s)
I should install and if I should upgrade my VS?

Thanks
--Rajesh.S
 
You should not upgrade just because of this, but there certainly are plenty
of other cool new features and reasons for upgrading.

This page lists all the available service packs that might affect the C#
compiler:
http://msdn.microsoft.com/vstudio/downloads/updates/sp.aspx

After you've installed the .Net framework 1.0 service pack 2, does the error
still happen? Can you please provide the complete error text, or even
better a small sample solution that also causes the problem?
 
I tried simulating a similar scenario in a fresh soln.
Now I get Compiler Error CS0570
'class' references a type not unsupported by the language

::The c++ code::
#using <mscorlib.dll>
public __gc class testICE
{
public:
void __gc *trythis()
{return reinterpret_cast<void __gc *>(new
testICE);}
};

::The c# code::
public class testclass
{
public static void Main (System.String[] a)
{new testICE().trythis();}
}

My requirement is to cast a managed class to void pointer
at the c++ layer and cast back to the managed class at
the c# layer.
How should I proceed?

Thanks
--Rajesh.S
 
Is there a reason you can't use an object instead of a void pointer? In
many cases where a void * was used in C/C++, object will work just fine in
C#. Just like in C/C++ where all pointer types can be cast to a void*, in
C# all types (except a few really weird ones) can be cast to object.

--
--Grant
This posting is provided "AS IS" with no warranties, and confers no rights.


Rajesh.S said:
I tried simulating a similar scenario in a fresh soln.
Now I get Compiler Error CS0570
'class' references a type not unsupported by the language

::The c++ code::
#using <mscorlib.dll>
public __gc class testICE
{
public:
void __gc *trythis()
{return reinterpret_cast<void __gc *>(new
testICE);}
};

::The c# code::
public class testclass
{
public static void Main (System.String[] a)
{new testICE().trythis();}
}

My requirement is to cast a managed class to void pointer
at the c++ layer and cast back to the managed class at
the c# layer.
How should I proceed?

Thanks
--Rajesh.S
-----Original Message-----
You should not upgrade just because of this, but there certainly are plenty
of other cool new features and reasons for upgrading.

This page lists all the available service packs that might affect the C#
compiler:
http://msdn.microsoft.com/vstudio/downloads/updates/sp.asp x

After you've installed the .Net framework 1.0 service pack 2, does the error
still happen? Can you please provide the complete error text, or even
better a small sample solution that also causes the problem?

--
--Grant
This posting is provided "AS IS" with no warranties, and confers no rights.





.
 
I had been using void pointer for standards compatibility
reasons. But now object pointer seems more logical soln.
Thanks Grant
--Rajesh.S

-----Original Message-----
Is there a reason you can't use an object instead of a void pointer? In
many cases where a void * was used in C/C++, object will work just fine in
C#. Just like in C/C++ where all pointer types can be cast to a void*, in
C# all types (except a few really weird ones) can be cast to object.

--
--Grant
This posting is provided "AS IS" with no warranties, and confers no rights.


Rajesh.S said:
I tried simulating a similar scenario in a fresh soln.
Now I get Compiler Error CS0570
'class' references a type not unsupported by the language

::The c++ code::
#using <mscorlib.dll>
public __gc class testICE
{
public:
void __gc *trythis()
{return reinterpret_cast<void __gc *>(new
testICE);}
};

::The c# code::
public class testclass
{
public static void Main (System.String[] a)
{new testICE().trythis();}
}

My requirement is to cast a managed class to void pointer
at the c++ layer and cast back to the managed class at
the c# layer.
How should I proceed?

Thanks
--Rajesh.S
-----Original Message-----
You should not upgrade just because of this, but there certainly are plenty
of other cool new features and reasons for upgrading.

This page lists all the available service packs that might affect the C#
compiler:
http://msdn.microsoft.com/vstudio/downloads/updates/sp.asp
x

After you've installed the .Net framework 1.0 service pack 2, does the error
still happen? Can you please provide the complete
error
text, or even
better a small sample solution that also causes the problem?
and
confers no rights.
I am using Visual Studio 2002 with
Microsoft .Net framework 1.0
I dont have any service packs installed.
Do you think that is the reason for the error?
If so can you please post what service pack(s)
I should install and if I should upgrade my VS?

Thanks
--Rajesh.S

-----Original Message-----
Which version of Visual Studio are you using? Have you
installed any of the
service packs?

--
--Grant
This posting is provided "AS IS" with no warranties, and
confers no rights.


some more info...

-----Original Message-----
I built a VC++.Net project as a dll and
included it as a reference in a c# project.
When I call a c++ function from the csharp
project I get internal compiler error.

The function in the c++ dll got the signature
void __gc *CInitialContext::Lookup(char *)
throw (CJMSException*)

The function was called in csharp as

CInitialContext m_ic = new CInitialContext();
String m_tcfName = "primaryTCF";

m_ic.Lookup((sbyte *)(Marshal.StringToHGlobalAnsi
(m_tcfName)).ToPointer());

.



.



.


.
 
Back
Top