CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • Installing SQL Server 2008
  • Writing UDFs for Firebird Embedded SQL Server
  • [Updated] Shutdown Manager
  • Building Windows Azure Cloud Service Applications with Azure Storage and the Azure SDK

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > Managed C++ and C++/CLI
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    Managed C++ and C++/CLI Discuss Managed C++ and .NET-specific questions related to C++.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1    
    Old July 12th, 2005, 01:16 AM
    svkr2k svkr2k is offline
    Member
     
    Join Date: Oct 2002
    Posts: 40
    svkr2k is an unknown quantity at this point (<10)
    Passing ostream object to the constructor of unmanaged class...

    Dear forum members,

    I have an unmanaged dll written in C++ using Visual Studio 6.0. I need to use this dll in an VC++ .Net application. The unmanaged dll has a class called CUnmanaged. Its constructor accepts reference to ostream object:

    CUnmanaged::CUnmanaged( ostream& os )
    {
    /* ... */
    }

    In the VC++.Net client application, the object of CUnmanaged is created as follows:

    filebuf fb;
    fb.open ("c:\\test1.txt",ios:: out);
    ostream os(&fb);
    os << "Test sentence\n";
    CUnmanaged objUnmanmaged( os );
    fb.close();

    When linking, I get the following error:
    error LNK2001: unresolved external symbol "public: __thiscall CUnmanaged::CUnmanaged(class std::basic_ostream<char,struct std::char_traits<char> > &)" (??CUnmanaged@@$$FQAE@AAV?$basic_ostream@DU?$char_traits@D@std@@@std@@@Z)

    Can anyone suggest some solution for this ?
    Thanks in advance.
    -Rajesh.

    Last edited by svkr2k; July 12th, 2005 at 01:25 AM.
    Reply With Quote
      #2    
    Old July 12th, 2005, 01:32 AM
    Andreas Masur Andreas Masur is offline
    Moderator
    Power Poster
     
    Join Date: May 2000
    Location: KY, USA
    Posts: 18,610
    Andreas Masur has a brilliant future (2000+)Andreas Masur has a brilliant future (2000+)Andreas Masur has a brilliant future (2000+)Andreas Masur has a brilliant future (2000+)Andreas Masur has a brilliant future (2000+)Andreas Masur has a brilliant future (2000+)Andreas Masur has a brilliant future (2000+)Andreas Masur has a brilliant future (2000+)Andreas Masur has a brilliant future (2000+)Andreas Masur has a brilliant future (2000+)Andreas Masur has a brilliant future (2000+)
    Re: Passing ostream object to an constructor of unmanaged class...

    Make sure that you have added all needed files for the dll (header plus import library). Other than that....did you export the constructor from the dll?
    __________________
    Ciao, Andreas

    "Software is like sex, it's better when it's free." - Linus Torvalds


    Article(s): Allocators (STL) Function Objects (STL)
    Reply With Quote
      #3    
    Old July 12th, 2005, 01:37 AM
    svkr2k svkr2k is offline
    Member
     
    Join Date: Oct 2002
    Posts: 40
    svkr2k is an unknown quantity at this point (<10)
    Re: Passing ostream object to an constructor of unmanaged class...

    Hi Andreas Masur,

    The class CUnmanaged is declared as:
    class __declspec (dllexport) CUnmanaged
    {
    public:
    CUnmanaged( ostream& os );

    CUnmanaged( const std::string& filename );

    /* more methods */

    }

    So, I hope the constructors are exported ?
    Reply With Quote
    Reply

    Bookmarks
    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > Managed C++ and C++/CLI


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 06:27 PM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
    Copyright WebMediaBrands Inc. 2002-2009