/////////////////////////////////////////////////////////////////////// /// BridgeToCPPengine.h - Shows how to use traditional, unmanaged /// /// ver 1.0 C++ packaged as a dll library from /// /// managed code. /// /// /// /// Language: Visual C++, ver 7.0, Visual Studio.Net /// /// Platform: Dell Dimension 8100, Windows Pro 2000 /// /// Application: CSE681 Example /// /// Author: Jim Fawcett, CST 2-187, Syracuse Univ. /// /// (315) 443-3948, jfawcett@twcny.rr.com /// /////////////////////////////////////////////////////////////////////// /* Public Interface: ----------------- Bridge br = new Bridge(); br.attach(someFile); br.getTok(tokStr); */ /////////////////////////////////////////////////////////////////////// /// build process /// /////////////////////////////////////////////////////////////////////// /// Required Files: /// /// BridgeToCPPengine.h, BridgeToCPPengine.cpp /// /// Compile Command: /// /// cl /MTd /LD BridgeToCPPengine.cpp /// /// Visual Studio IDE: /// /// - set compiler options to place dll in TestBridge/Debug /// /// - use managed C++ library project /// /// Run Command: /// /// none /// /////////////////////////////////////////////////////////////////////// /* Maintenance History =================== ver 1.0 : 09/13/02 - first release */ // #pragma once #using #include "tok.h" #include using namespace System; using namespace System::Text; namespace bridgeToCPPengine { // can't: // - be templated // - use friends // - use multiple inheritance class TokMgr { private: toker* _toker; ifstream input; public: TokMgr() : _toker(0) {} bool SetStream(String* fileName); bool GetTok(String*& pTok); }; public __gc class Bridge { // need gcroot here? TokMgr* pTokMgr; public: Bridge() { pTokMgr = new TokMgr(); } ~Bridge() { delete pTokMgr; } bool attach(String* fileName); bool GetTok(String*& pTok); }; }