| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | Newsletters | VB Forums | Developer.com |
|
|||||||
| Managed C++ and C++/CLI Discuss Managed C++ and .NET-specific questions related to C++. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
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) |
|
#3
|
|||
|
|||
|
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 ? |
![]() |
| Bookmarks |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|