473,757 Members | 9,463 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 ::HCFAWebServic eEntryPoint': an unmanaged type
cannot derive from a managed type 'System::Web::S ervices::WebSer vice' - line
12

HCFAWebServiceE ntryPoint.h
=============== =============
#using <System.Web.Ser vices.dll>
#using <System.dll>

using namespace System;
using namespace System::Web;
using namespace System::Web::Se rvices;

namespace HCFAWebService
{

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

public:
[System::Web::Se rvices::WebMeth od]
int CallHCFA( int editno, LPSTR inbuf, LPSTR inSV, LPSTR inDB, LPSTR
inUI, LPSTR inPW, LPSTR inPCA, LPSTR inDSN, LPSTR inFl);
};
}
// HCFAWebServiceE ntryPoint.cpp : main project file.
//
#include "stdafx.h"
#include "HCFAWebService EntryPoint.h"
#include "Ecghcfa.h"
#include "Global.asa x.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.c om
http://www.dotnetmonster.com/Uwe/For...et-vc/200612/1

Dec 9 '06 #1
2 5786
On Sat, 09 Dec 2006 20:27:26 GMT, "andy6 via DotNetMonster.c om" <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 ::HCFAWebServic eEntryPoint': an unmanaged type
cannot derive from a managed type 'System::Web::S ervices::WebSer vice' - line
12

HCFAWebService EntryPoint.h
============== ==============
#using <System.Web.Ser vices.dll>
#using <System.dll>

using namespace System;
using namespace System::Web;
using namespace System::Web::Se rvices;

namespace HCFAWebService
{

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

public:
[System::Web::Se rvices::WebMeth od]
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 HCFAWebServiceE ntryPoint : 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 HCFAWebServiceE ntryPoint : 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.c om
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
40029
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 deals with managed in one place, and code that deals with unmanaged in another place, but I can't seem to find anything that clearly explains what that means. I think if I used a Windows API function to optain a handle, that handle would be an...
1
1654
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 code which works well. I understand the basic concept: our code is unmanaged, Windows Forms is Managed and Unmanaged may not call Managed code. I read about Wrappers, PInvoke, Runtime Callable Wrappers for COM and about It just
13
5054
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 use that dll from pure unmanaged code (for example inherit from classes in that dll). Is something like that possible. I heared something called ManWarp tried that approach. If it is possible, how can I do that. Maybe there is a small litttle
1
2388
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( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
4
2445
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 some specific things.. for example, I have unmanaged class class Foo { void SetData(std::map<std::string, std::stringsvalue); };
2
1994
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 unmanaged type cannot derive from a managed type 'System::MarshalByRefObject' " Object Code : #include "stdafx.h"
0
2948
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 unmanaged code in concert with a managed application that makes calls to the DLL. This problem has been cropping up for a while, but the debugger provides very little information (from what I can tell) as to what exactly is the problem.
17
7253
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 to show the array data to the end user. Can I do that? How?
2
12359
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 classes in managed C++ as a wrapper to the unmanaged C++ classes or is there an easier way? Essentially what I have done is written a C++ kernel mode driver and I want to use it from my C# program. Because it requires some setup outside the...
0
9298
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,...
0
10072
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9906
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9885
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
8737
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
7286
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
6562
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
5329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2698
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.