Basic question ASP.net webservice written in c++

Discussion in 'ASP .Net' started by Kristof Thys, Sep 22, 2004.

  1. Kristof Thys

    Kristof Thys Guest

    I'm creating a ASP.net webservice written in c++, so I'm posting it 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
     
    Kristof Thys, Sep 22, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve C. Orr, MCSD
    Replies:
    1
    Views:
    572
    reaway lee
    Aug 24, 2003
  2. Priya
    Replies:
    0
    Views:
    342
    Priya
    Nov 25, 2003
  3. Andrea Raimondi
    Replies:
    1
    Views:
    508
  4. KaiWen
    Replies:
    102
    Views:
    2,790
    Jorgen Grahn
    Sep 15, 2011
  5. Geofrey van Hecke
    Replies:
    0
    Views:
    147
    Geofrey van Hecke
    Feb 27, 2007
Loading...

Share This Page