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 function upon it, like this:
String __gc* JagaWebserviceClass::HelloWorld()
{
ManagedWrapperClass *mw;
return mw->function();
}
I include Managedwrapper.h wich contains the following:
#include "stdafx.h"
#pragma once
#include "Interface.h"
#pragma managed
__gc class ManagedWrapperClass{
private:
Interface * i;
public:
ManagedWrapperClass() {i = new Interface;}
~ManagedWrapperClass() {delete i;}
const char* function() {return i->testfunction();}
};
In interface.h, I define my class interface:
#include "stdafx.h"
class Interface{
public:
Interface() {}
~Interface() {}
char* testfunction();
};
I create (like I always do in c++) an .cpp file, with the implementation
of my testfunction
interface.cpp:
#include "stdafx.h"
#include "Interface.h"
char* Interface::testfunction()
{
return "test";
}
But this does not work. When I put the implementation of testfunction
inline in my header file. It works perfect.
Why is this?
I can't put all my implementations is my .h because in the next step, I
will include an old project, and rewriting it is not an option...
Please help?
thx,
Kristof