473,586 Members | 2,870 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

asp.net webservice in c++ with unmanaged c++

Hello,

I've been struggling for weeks with this problem, I hope I find some help here...

To start, in our company, we have a large existing c++ project (native code, unmanaged c++)

The objective is to write a webservice for some of the functionalities from this project.
The best way to do this in Visual Studio .NET 2003 seems to me by creating an ASP.NET Web service in c++.
I create the default template, wich works just fine.
Now I want to use some unmanaged c++ code, so I write a managed wrapperclass and delegate the old routines from identical

methods. When I test this with an unmanaged c++ class in the same project, this works fine.
But when I include an header from the old project, and call some old routines, I get link problems for every implemented

routine.

e.g.:
error LNK2001: unresolved external symbol "public: __thiscall test::~test(voi d)" (??1test@@$$FQA E@XZ)
error LNK2001: unresolved external symbol "public: char * __thiscall test::function( int,int)" (?function@test @@$$FQAEPADHH@Z )
...

I've read http://msdn.microsoft.com/library/de...ingProblem.asp

concerning mixed dll problems, and figured out this could be my problem, and tried the solution at :
http://support.microsoft.com/?id=814472
But here rises another problem for me, none of the given solutions seems applicable to my particular problem,

I don't think my DLL isn't entered using DLL exports (__declspec(dll export)),
not it seems to be a COM-based DLL.
and "Consumers of your DLL can use managed code, and your DLL contains either DLL exports or managed entry points." doesnt

work for my project neither...

So I'm pretty stuck...

I need some help, if you wish you can simulate my problem:

just create a default ASP.NET webservice : called e.g. Webservice

add managedwrapper. h :

#pragma once

#include "test.h"

#pragma managed

__gc class ManagedWrapperC lass{
private:
test * t;
public:
ManagedWrapperC lass() {t = new test;}
~ManagedWrapper Class() {delete t;}
const char* function() {return t->function();}
};

in webserviceclass .cpp, include "managedwrapper .h" and rewrite the helloworld routine :
String* webserviceClass ::HelloWorld()
{
ManagedWrapperC lass *m = new ManagedWrapperC lass();
return m->function();
}
and now create a console application (.NET) (c++) e.g. testconsole

add a file test.h :

class test{
public:
test() {}
~test() {}
char* function() {return "Wow you did it...";}
};
in webservice -> project settings -> c/c++ -> General -> Additional include Directories : add ../testconsole

I want to thank everyone who tries to help me with this one!
I've just started working and after 3 years of studying in VC6.0.. .NET and webservices are pretty new...

Thanks in Advance,


Kristof Thys

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>3SrKM0vBOk6 vFSTJSGwZHg==</Id>
Nov 17 '05 #1
0 960

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

Similar topics

0
1220
by: Russ | last post by:
I'm trying to use InteropServices in a web service, by following the examples and info in the article "Consuming Unmanaged DLL Functions" in the .NET Framework Developer's Guide. I am able to add prototypes for unmanaged code and compile and link the C++ managed code web service (based on the TempConvert3 walkthrough). I added web methods...
6
768
by: Davie | last post by:
I want to authorise a user of a web service by using the AuthHeaderValue for some reason I keep getting a null reference exception when I try to run the following code: It seems to work fine on a .NET Framework application, but just not on the .NET CF version. Can anyone suggest anything that might be wrong with the code? (I could post...
7
1728
by: Kristof Thys via .NET 247 | last post by:
Post a new message to microsoft.public.dotnet.languages.vc http://www.dotnet247.com/247reference/default.aspx Hello, I've been struggling for weeks with this problem, I hope I find some help here...
0
835
by: Kristof Thys | last post by:
Hello, I am writing a webservice for some older c++ classes. I build these unmanaged classes as a dll, and in my webservice I add a reference to this dll. I include the necessary headerfiles, and when I call a function from my old project, everything compiles and links fine. When I debug, I can see the webservice-functions in my...
0
911
by: Kristof Thys | last post by:
I'm creating a ASP.net webservice written in c++, so I'm posting my question on both the aspnet and vc newsgroups. I hope somebody can help me... What I want to do seems basic c++ to me... I create a template ASP.net webservice. In the helloworld function, I create an instance of a wrapperclass (wich wraps unmanaged C++), and call a...
1
1634
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...
3
3473
by: cipher | last post by:
I'm trying to use an MFC extension dll in my C++ ASP.NET Web Service project. I have changed my project settings to specify using MFC as a shared dll. However, when I try to compile, I get the following error on one of the extension dll header files: error C2491: 'CGisPtrArray<TYPE>::__ctor' : definition of dllimport function not allowed...
0
981
by: Adam M. Rosenzweig | last post by:
Hello, I am having a problem getting a particular web service to work on a win 2003 server. This web service does work on my XP box. The web service is written in VB.NET, and uses a declare statement to access a function in an umnanaged dll built using Visual C++ 2003. The function in the dll returns an XLOPER *, which in the VB code I...
1
2063
by: =?Utf-8?B?YXVzdGlyb2I=?= | last post by:
Hi, Any help with this problem would be greatly apprecicated as it is driving me insane. I have an ASP.NET 2.0 Webservice running on Windows server 2003. The
0
7911
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8338
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...
1
7954
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...
0
6610
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...
0
5390
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...
0
3836
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1448
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.