Error when using TakeCmd.lib

Just starting out? Need help? Post your questions and find answers here.
JoeC4281
User
User
Posts: 29
Joined: Fri Aug 06, 2021 4:47 pm

Error when using TakeCmd.lib

Post by JoeC4281 »

I started using PureBasic in early August of this year.

I have successfully created my first 64-bit Plugin DLL for Take Command Console using PureBasic.
https://jpsoft.com/forums/threads/64-bi ... post-62092

I'm now trying to incorporate the TakeCmd.lib into PureBasic, but I keep getting an error (see code below) when I run the tcclib.exe that I created.

Note that TakeCmd.lib was created using Microsoft Visual C++ x64 (latest version).

Constructive suggestions would be appreciated.

Thanks from Joe.

Code: Select all

; PureBasic 5.73 LTS (Windows - x64)
;
;TCC  28.01.14 x64   Windows 10 [Version 10.0.19043.1237]
;BuildNumber  Caption                   CSDVersion  OSArchitecture  Version
;19043        Microsoft Windows 10 Pro              64-bit          10.0.19043
;

; Folder contains;
; - tcclib.pb   (Source code, this file)
; - TakeCmd.lib (from Plugin SDK)
; - takecmd.dll (from TCMD 28)
; - tcclib.exe  (.EXE generated from source code)
;
EnableExplicit

; Plugin SDK
; https://jpsoft.com/downloads/sdk/sdk.zip
;
; dumpbin /exports takecmd.lib | findstr /c:"QueryIsTCMD"
;                   ?QueryIsTCMD@@YAHXZ (int __cdecl QueryIsTCMD(void))
;
Import "takecmd.lib"
  QueryIsTCMD_() As "?QueryIsTCMD@@YAHXZ"
EndImport

Global ws.i

If OpenConsole()
  ws = QueryIsTCMD_()
  CloseConsole()
EndIf 
;
;---------------------------
;tcclib.exe - Application Error
;---------------------------
;The application was unable To start correctly (0xc000007b). Click OK To close the application. 
;---------------------------
;OK   
;---------------------------

; IDE Options = PureBasic 5.73 LTS (Windows - x64)
; ExecutableFormat = Console
; CursorPosition = 20
; FirstLine = 3
; EnableXP
; Executable = tcclib.exe
; Compiler = PureBasic 5.73 LTS (Windows - x64)
; Debugger = IDE
JoeC4281
User
User
Posts: 29
Joined: Fri Aug 06, 2021 4:47 pm

Re: Error when using TakeCmd.lib

Post by JoeC4281 »

Well, apparently TakeCmd.dll needs to be initialized in a way that only tcmd.exe and tcc.exe know how to do.
https://jpsoft.com/forums/threads/takec ... post-62096

Thus, TakeCmd.dll will not work with any program designed for use as a stand-alone .EXE, and will only work within a Plugin .DLL

I have tested this, and yes, I can use TakeCmd.dll with a PureBasic-created Plugin .DLL, call functions, and all works as it should.

Posting here mainly for my future reference, but others might be interested as well.

Joe
Post Reply