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

an unmanaged type cannot derive from a managed type

I took a c++ 6.0 project and converted it to c++ .net 2005 project. I want to
make a web service out of it. One of the new files I created was a cpp where
I have the webmethod pointing to a function in the previously 6.0 code and I
get the error noted below. What I don't understand is since I created this
cpp as a new file in .net and inherited from a .net base class then why would
I get this error? Both the class and base class to me should be managed.
Below is the code, can you help me resolve the error?

error C3625: 'HCFAWebService::HCFAWebServiceEntryPoint': an unmanaged type
cannot derive from a managed type 'System::Web::Services::WebService' - line
12

HCFAWebServiceEntryPoint.h
============================
#using <System.Web.Services.dll>
#using <System.dll>

using namespace System;
using namespace System::Web;
using namespace System::Web::Services;

namespace HCFAWebService
{

public class HCFAWebServiceEntryPoint : public WebService
{ // Visual Studio points to line 12 as being here

public:
[System::Web::Services::WebMethod]
int CallHCFA( int editno, LPSTR inbuf, LPSTR inSV, LPSTR inDB, LPSTR
inUI, LPSTR inPW, LPSTR inPCA, LPSTR inDSN, LPSTR inFl);
};
}
// HCFAWebServiceEntryPoint.cpp : main project file.
//
#include "stdafx.h"
#include "HCFAWebServiceEntryPoint.h"
#include "Ecghcfa.h"
#include "Global.asax.h"

namespace HCFAWebService
{
int CallHCFA(int a, LPSTR b, LPSTR c, LPSTR d, LPSTR e, LPSTR f, LPSTR g,
LPSTR h, LPSTR k)
{
CEcghcfaApp *pValidateClaim = new CEcghcfaApp();

int ab = pValidateClaim->ValidateClaim(a,b,c,d,e,f,g,h,k);

delete pValidateClaim;

return ab;
}
}

--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...et-vc/200612/1

Dec 9 '06 #1
2 5754
On Sat, 09 Dec 2006 20:27:26 GMT, "andy6 via DotNetMonster.com" <u9025@uwe>
wrote:
>I took a c++ 6.0 project and converted it to c++ .net 2005 project. I want to
make a web service out of it. One of the new files I created was a cpp where
I have the webmethod pointing to a function in the previously 6.0 code and I
get the error noted below. What I don't understand is since I created this
cpp as a new file in .net and inherited from a .net base class then why would
I get this error? Both the class and base class to me should be managed.
Below is the code, can you help me resolve the error?

error C3625: 'HCFAWebService::HCFAWebServiceEntryPoint': an unmanaged type
cannot derive from a managed type 'System::Web::Services::WebService' - line
12

HCFAWebServiceEntryPoint.h
============================
#using <System.Web.Services.dll>
#using <System.dll>

using namespace System;
using namespace System::Web;
using namespace System::Web::Services;

namespace HCFAWebService
{

public class HCFAWebServiceEntryPoint : public WebService
{ // Visual Studio points to line 12 as being here

public:
[System::Web::Services::WebMethod]
int CallHCFA( int editno, LPSTR inbuf, LPSTR inSV, LPSTR inDB, LPSTR
inUI, LPSTR inPW, LPSTR inPCA, LPSTR inDSN, LPSTR inFl);
};
}
Use the "ref" keyword when you declare the class:

public ref class HCFAWebServiceEntryPoint : public WebService

--
Doug Harrison
Visual C++ MVP
Dec 9 '06 #2
Doug Harrison [MVP] wrote:
>>I took a c++ 6.0 project and converted it to c++ .net 2005 project. I want to
make a web service out of it. One of the new files I created was a cpp where
[quoted text clipped - 29 lines]
> };
}

Use the "ref" keyword when you declare the class:

public ref class HCFAWebServiceEntryPoint : public WebService

Beautiful! Thank you!

I had to look it up in VS2005 documentation...here's what it said:

Declaration of a Managed Class Type

The way to declare a reference class type changed from Managed Extensions for
C++ to Visual C++ 2005.

In Managed Extensions, a reference class type is prefaced with the __gc
keyword. In the new syntax, the __gc keyword is replaced by one of two spaced
keywords: ref class or ref struct. The choice of struct or class simply
indicates the public (for struct) or private (for class) default access level
of its members declared within an initial unlabeled portion of the body of
the type.

Similarly, in Managed Extensions, a value class type is prefaced with the
__value keyword. In the new syntax, the __value keyword is replaced by one of
two spaced keywords: value class or value struct.

An interface type, in Managed Extensions, was indicated with the keyword
__interface. In the new syntax, this is replaced with interface class.

Thanks Doug!

--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...et-vc/200612/1

Dec 9 '06 #3

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

Similar topics

4
by: Rachel Suddeth | last post by:
What is the difference between a managed/unmanaged resource, and how do you tell which is which? I'm trying to understand how to write some Dispose() methods, and we are supposed to put code that...
1
by: Sparhawk | last post by:
Hi, my company is going to migrate a large VC++ application to .NET to make use of Windows Forms (the old class library is not updated any more). We are not planning to migrate the rest of the...
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...
1
by: quat | last post by:
I have two unmanaged pointer in a managed form class: IDirect3D9* d3dObject; IDirect3DDevice9* d3dDevice; In a member function of the form, I call: d3dObject->CreateDevice(...
4
by: devmentee | last post by:
I want to write a managed wrapper( kind of proxy) which will call into unmanaged C++ code. I've got a general idea and have read some articles on how to do it. But I cannot find any information on...
2
by: MeGeek | last post by:
Hi, I wanted to develop an unmanaged application of .Net Remoting in VC++. When I tried compiling the object dll, it is giving the following error, "C3625: 'ObjectNamespace::RefObject': an...
0
by: HeroOfSpielburg | last post by:
Hello, I'm new to the realm of .NET application creation, so please forgive my ignorance. I have been tasked with debugging a problem that arises with using a DLL that contains managed and...
17
by: =?Utf-8?B?U2hhcm9u?= | last post by:
Hi Gurus, I need to transfer a jagged array of byte by reference to unmanaged function, The unmanaged code should changed the values of the array, and when the unmanaged function returns I need...
2
by: Jon Slaughter | last post by:
How difficult is it for one to integrate unmanaged C++ into C#? I know for functions one can use DLLimport but how does one go about doing it for classes? Do I have to completely reimplement the...
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...
0
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,...

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.