Objective: Create a template, using PureBasic, for a Take Command Console plugin.
As I am not interested in utilizing Take Command internals via a plugin at this time, I do not need;
#include "TakeCmd.h"
from PlugIn.cpp
The PlugIn.cpp code can be viewed at https://github.com/JoeC4281/PureBasicTC ... plugin.cpp
Note that this is the code that I am using as a basis for creating the PureBasic code.
Here's the PureBasic code (plugin.pb) I have developed, which is not doing what it is supposed to;
Code: Select all
; These 4 procedures are Windows specific
;
; This procedure is called once, when the program loads the library
; for the first time. All init stuffs can be done here (but not DirectX init)
;
ProcedureDLL AttachProcess(Instance)
EndProcedure
; Called when the program release (free) the DLL
;
ProcedureDLL DetachProcess(Instance)
EndProcedure
; Both are called when a thread in a program call or release (free) the DLL
;
ProcedureDLL AttachThread(Instance)
EndProcedure
ProcedureDLL DetachThread(Instance)
EndProcedure
Structure PLUGININFO_STRUCT
pszDll.l
pszAuthor.l
pszEmail.l
pszWWW.l
pszDescription.l
pszFunctions.l
nMajor.l
nMinor.l
nBuild.l
EndStructure
ProcedureDLL.l InitializePlugin()
OutputDebugString_("InitializePlugin")
ProcedureReturn #Null
EndProcedure
ProcedureDLL.l ShutdownPlugin(bEndProcess.b)
OutputDebugString_("ShutdownPlugin")
ProcedureReturn #Null
EndProcedure
ProcedureDLL.l GetPluginInfo()
OutputDebugString_("GetPluginInfo")
Static pi.PLUGININFO_STRUCT
Define DLLname.s
Define DLLauth.s
Define DLLmail.s
Define DLLwww.s
Define DLLdesc.s
Define DLLfuns.s
DLLname = "Plugin Dummy"
DLLauth = "Joe Caverly"
DLLmail = "jlcaverlyca@yahoo.ca"
DLLwww = "https://www.twitter.com/JoeC4281"
DLLdesc = "TCC Plugin Template written using Purebasic"
DLLfuns = "@Reverse"
pi\pszDll = @DLLname
pi\pszAuthor = @DLLauth
pi\pszEmail = @DLLmail
pi\pszWWW = @DLLwww
pi\pszDescription = @DLLdesc
pi\pszFunctions = @DLLfuns
pi\nMajor = 2021
pi\nMinor = 8
pi\nBuild = 7
; How do I return the PluginInfo to TCC?
ProcedureReturn @pi
EndProcedure
ProcedureDLL.l f_Reverse(*pstrArgs)
; How do I get the text from *pstrArgs?
; ReverseString("Stuff")
; How do I return the reversed string back via *pstrArgs?
ProcedureReturn #Null
EndProcedure
"C:\Program Files\PureBasic\Compilers\pbcompiler.exe" /dll plugin.pb /exe "plugin.dll"
Code: Select all
******************************************
PureBasic 5.73 LTS (Windows - x64)
******************************************
Compiling plugin.pb
Loading external libraries...
Starting compilation...
82 lines processed.
Creating DLL "plugin.dll"
- Feel the ..PuRe.. Power -
Code: Select all
file plugin.dll
plugin.dll: PE32+ executable (DLL) (console) x86-64, for MS Windows
dumpbin /exports plugin.dll
Code: Select all
Microsoft (R) COFF/PE Dumper Version 14.29.30133.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file plugin.dll
File Type: DLL
Section contains the following exports for plugin.dll
00000000 characteristics
61282C10 time date stamp Thu Aug 26 20:04:32 2021
0.00 version
1 ordinal base
4 number of functions
4 number of names
ordinal hint RVA name
1 0 00001169 GetPluginInfo
2 1 000010E5 InitializePlugin
3 2 00001107 ShutdownPlugin
4 3 00001150 f_Reverse
Summary
1000 .code
1000 .data
1000 .pdata
1000 .rdata
1000 .reloc
1000 .text
DbgView.exe shows the functions that were accessed;plugin /l plugin.dll
Code: Select all
[21976] InitializePlugin
[21976] GetPluginInfo
from the TCC Command Line shows that TCC does not see the plugin.plugin plugin
Note also that
command does not unload the DLL.plugin /u plugin
Thus, even though GetPluginInfo was called, the results were not returned to TCC.
Links to the TCC Plugin SDK, and other TCC info at viewtopic.php?f=7&t=77724
Constructive suggestions would be appreciated on how to return the PluginInfo to TCC, return the results of the reverse string function, and get this working.
Thanks from Joe
Code: Select all
PureBasic 5.73 LTS (Windows - x64) - (c) 2020 Fantaisie Software
TCC 28.00.12 x64 Windows 10 [Version 10.0.19043.1165]
Processor Intel(R) Xeon(R) CPU E5-2650 v2 @ 2.60GHz 2.60 GHz (2 processors)
Installed RAM 128 GB
Device ID 7334AD11-227D-4EA2-A424-EE5C735B7AF1
Product ID 00330-80000-00000-AA032
System type 64-bit operating system, x64-based processor
Pen and touch No pen or touch input is available for this display
Edition Windows 10 Pro
Version 21H1
Installed on 2021-01-16
OS build 19043.1165
Experience Windows Feature Experience Pack 120.2212.3530.0