By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,018 Members | 884 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,018 IT Pros & Developers. It's quick & easy.

Internal Compiler Error

P: n/a
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());

.

Nov 15 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
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.
"Rajesh.S" <ra*******@hotmail.com> wrote in message
news:20****************************@phx.gbl...
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());

.

Nov 15 '05 #2

P: n/a
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 theservice packs?

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

"Rajesh.S" <ra*******@hotmail.com> wrote in message
news:20****************************@phx.gbl...
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());
>
>.
>

.

Nov 15 '05 #3

P: n/a
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/do...pdates/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?

--
--Grant
This posting is provided "AS IS" with no warranties, and confers no rights.
"Rajesh.S" <ra*******@hotmail.com> wrote in message
news:27****************************@phx.gbl...
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.


"Rajesh.S" <ra*******@hotmail.com> wrote in message
news:20****************************@phx.gbl...
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());
>
>.
>

.

Nov 15 '05 #4

P: n/a
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 plentyof 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/do...updates/sp.asp x
After you've installed the .Net framework 1.0 service pack 2, does the errorstill happen? Can you please provide the complete error text, or evenbetter a small sample solution that also causes the problem?
--
--Grant
This posting is provided "AS IS" with no warranties, and confers no rights.

"Rajesh.S" <ra*******@hotmail.com> wrote in message
news:27****************************@phx.gbl...
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.
>
>
>"Rajesh.S" <ra*******@hotmail.com> wrote in message
>news:20****************************@phx.gbl...
>> 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());
>> >
>> >.
>> >
>
>
>.
>

.

Nov 15 '05 #5

P: n/a
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" <ra*******@hotmail.com> wrote in message
news:51****************************@phx.gbl...
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/do...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.


"Rajesh.S" <ra*******@hotmail.com> wrote in message
news:27****************************@phx.gbl...
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.
>
>
>"Rajesh.S" <ra*******@hotmail.com> wrote in message
>news:20****************************@phx.gbl...
>> 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());
>> >
>> >.
>> >
>
>
>.
>

.

Nov 15 '05 #6

P: n/a
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? Inmany cases where a void * was used in C/C++, object will work just fine inC#. Just like in C/C++ where all pointer types can be cast to a void*, inC# 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" <ra*******@hotmail.com> wrote in message
news:51****************************@phx.gbl...
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/do...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.
>
>
>"Rajesh.S" <ra*******@hotmail.com> wrote in message
>news:27****************************@phx.gbl...
>> 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.
>> >
>> >
>> >"Rajesh.S" <ra*******@hotmail.com> wrote in message
>> >news:20****************************@phx.gbl...
>> >> 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());
>> >> >
>> >> >.
>> >> >
>> >
>> >
>> >.
>> >
>
>
>.
>

.

Nov 15 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.