473,387 Members | 1,517 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,387 software developers and data experts.

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(void)" (??1test@@$$FQAE@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(dllexport)),
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 ManagedWrapperClass{
private:
test * t;
public:
ManagedWrapperClass() {t = new test;}
~ManagedWrapperClass() {delete t;}
const char* function() {return t->function();}
};

in webserviceclass.cpp, include "managedwrapper.h" and rewrite the helloworld routine :
String* webserviceClass::HelloWorld()
{
ManagedWrapperClass *m = new ManagedWrapperClass();
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>3SrKM0vBOk6vFSTJSGwZHg==</Id>
Nov 17 '05 #1
0 947

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

Similar topics

0
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...
6
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...
7
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...
0
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,...
0
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... ...
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...
3
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...
0
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...
1
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
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
0
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...
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...

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.