Jump to content

JackT

Members
  • Content Count

    26
  • Joined

  • Last visited

Everything posted by JackT

  1. //--------------------------------------------------------------------------- #ifndef SolidBridgeH #define SolidBridgeH //--------------------------------------------------------------------------- #endif #include <LoftyBridge.hpp> #include <System.Classes.hpp> #include <System.Generics.Collections.hpp> #include <System.SysUtils.hpp> class TBridgeException:Exception { private: protected: public: }; class TBridge:TAbstractBridge { private: TList *ModuleList; void CleanUpModuleList(); protected: public: TBridge(); //~TBridge(); void __fastcall About(); void __fastcall ReQuery(); int __fastcall ModuleCount(); bool __fastcall GetModuleData(int Index, RModuleData &pModuleData); bool __fastcall GetModuleChannels(int Index, System::Classes::TStringList* &pSL); bool __fastcall GetSafeModuleChannelList(char * pBuffer,int Index, int MaxLen); void __fastcall Finalize(); }; typedef TBridge *pTBridge; typedef TList__1<TBridge> TBridgeList; typedef TBridgeList *pTBridgeList; extern "C" __declspec(dllexport) TAbstractBridge* __stdcall SolidBridgeFactory(); // CodeGear C++Builder // Copyright (c) 1995, 2022 by Embarcadero Technologies, Inc. // All rights reserved // (DO NOT EDIT: machine generated header) 'LoftyBridge.pas' rev: 35.00 (Windows) #ifndef LoftybridgeHPP #define LoftybridgeHPP #pragma delphiheader begin #pragma option push #pragma option -w- // All warnings off #pragma option -Vx // Zero-length empty class member #pragma pack(push,8) #include <System.hpp> #include <SysInit.hpp> #include <System.Classes.hpp> //-- user supplied ----------------------------------------------------------- namespace Loftybridge { //-- forward type declarations ----------------------------------------------- struct RModuleData; class DELPHICLASS TCppBuilderObject; class DELPHICLASS TAbstractBridge; //-- type declarations ------------------------------------------------------- typedef System::StaticArray<char, 256> ShortAnsiString; struct DECLSPEC_DRECORD RModuleData { public: ShortAnsiString name; ShortAnsiString product_type; bool not_chassied; unsigned SerialNo; unsigned SlotNo; }; typedef RModuleData *pModuleData; typedef System::Classes::TStringList* *pTStringList; #pragma pack(push,4) class PASCALIMPLEMENTATION TCppBuilderObject : public System::TObject { typedef System::TObject inherited; public: virtual void __fastcall Finalize() = 0 ; HIDESBASE void __fastcall Free(); public: /* TObject.Create */ inline __fastcall TCppBuilderObject() : System::TObject() { } /* TObject.Destroy */ inline __fastcall virtual ~TCppBuilderObject() { } }; #pragma pack(pop) #pragma pack(push,4) class PASCALIMPLEMENTATION TAbstractBridge : public TCppBuilderObject { typedef TCppBuilderObject inherited; public: virtual void __fastcall About() = 0 ; virtual void __fastcall ReQuery() = 0 ; virtual int __fastcall ModuleCount() = 0 ; virtual bool __fastcall GetModuleData(int Index, RModuleData &pModuleData) = 0 ; virtual bool __fastcall GetModuleChannels(int Index, System::Classes::TStringList* &pSL) = 0 ; virtual bool __fastcall GetSafeModuleChannelList(char * pBuffer, int Index, int MaxLen) = 0 ; public: /* TObject.Create */ inline __fastcall TAbstractBridge() : TCppBuilderObject() { } /* TObject.Destroy */ inline __fastcall virtual ~TAbstractBridge() { } }; #pragma pack(pop) //-- var, const, procedure --------------------------------------------------- static const System::Int8 NI_MODULE = System::Int8(0x0); static const System::Int8 NI_CHANNEL = System::Int8(0x1); static const System::Word STRING_SIZE = System::Word(0x100); extern "C" TAbstractBridge* __stdcall SolidBridgeFactory(); extern DELPHI_PACKAGE TAbstractBridge* __stdcall BridgeFactory(); } /* namespace Loftybridge */ #if !defined(DELPHIHEADER_NO_IMPLICIT_NAMESPACE_USE) && !defined(NO_USING_NAMESPACE_LOFTYBRIDGE) using namespace Loftybridge; #endif #pragma pack(pop) #pragma option pop #pragma delphiheader end. //-- end unit ---------------------------------------------------------------- #endif // LoftybridgeHPP unit LoftyBridge; {WARNING THIS UNIT MAY CAUSE MEMORY ISSUES IT IS AN INTERFACE FOR NIBridge writen in C++ Builder Try ShareMem in the uses clause USE SAFE FUNCTIONS WITH NO ShareMem } interface uses Classes; const NI_MODULE = 0; NI_CHANNEL = 1; const STRING_SIZE= 256; type ShortAnsiString = array[1..256] of ansichar; type RModuleData = record name:ShortAnsiString; product_type:ShortAnsiString; not_chassied:boolean; SerialNo:uInt32; SlotNo:uInt32; end; type pModuleData = ^RModuleData; type pTStringList = ^TStringList; Type TCppBuilderObject = class private protected public procedure Finalize();virtual;abstract; procedure Free(); end; type TAbstractBridge = class(TCppBuilderObject) private protected //procedure Finalize();virtual;abstract; public procedure About();virtual;abstract; procedure ReQuery();virtual;abstract; function ModuleCount():integer;virtual;abstract; function GetModuleData(Index:integer; var pModuleData:RModuleData):boolean;virtual;abstract; function GetModuleChannels(Index:integer;var pSL:TStringList):boolean;virtual;abstract; function GetSafeModuleChannelList(pBuffer:PAnsiChar;Index:Integer;MaxLen:Integer):boolean;virtual;abstract; end; {$IFDEF TEST_BRIDGE} function SolidBridgeFactory():TAbstractBridge;stdCall;external 'C:\CBuild\NIBridge.bpl'; {$ELSE} {$IFDEF WIN32} function SolidBridgeFactory():TAbstractBridge;stdCall;external 'NIBridge.bpl'; {$ENDIF} {$IFDEF WIN64} function SolidBridgeFactory():TAbstractBridge;stdCall;external 'NIBridge.bpl'; {$ENDIF} {$ENDIF} function BridgeFactory():TAbstractBridge;stdCall implementation function BridgeFactory():TAbstractBridge;stdCall begin result := nil; end; { TAbstractBridge } { TCppBuilderObject } procedure TCppBuilderObject.Free; begin Finalize(); inherited; end; { TAbstractBridge } end.
×