64-bit Plugin development using PureBasic

I am attempting to generate a 64-bit TCC plugin template using PureBasic.

Back in 2011, @gwgaston provided a 32-bit PowerBasic solution for me, which allowed me to develop several plugins for 32-bit TCC.

(Bob Zale, owner and developer of PowerBasic, passed away in 2012, thus no 64-bit version of PowerBasic is available.)

What I have tried with PureBasic, so far, is not working properly.

I have posted the source code and issues I am having on the PureBasic Forum.

Is there any TCC user who uses PureBasic, and would be interested in the development of a TCC plugin template?

Joe
 
Thanks to the guidance of Mijikai at the PureBasic forum, I now have a working TCC Plugin Template, compile-able with PureBasic.
Code:
EnableExplicit

Import ""
  wprintf.i(format.s)
EndImport

Structure PLUGININFO_STRUCT
    *pszDll
    *pszAuthor
    *pszEmail
    *pszWWW
    *pszDescription
    *pszFunctions    
    nMajor.l
    nMinor.l
    nBuild.l
    hModule.i
    *pszModule
EndStructure

ProcedureDLL.i InitializePlugin()
  ProcedureReturn #Null  
EndProcedure

ProcedureDLL.i ShutdownPlugin(bEndProcess.b)
  ProcedureReturn #Null  
EndProcedure

ProcedureDLL.i GetPluginInfo()
  Static pi.PLUGININFO_STRUCT
  Static DLLname.s
  Static DLLauth.s
  Static DLLmail.s
  Static DLLwww.s
  Static DLLdesc.s
  Static DLLfuns.s
  
  DLLname = "PBPlugin"
  DLLauth = "Joe Caverly"
  DLLmail = "jlcaverlyca@yahoo.ca"
  DLLwww  = "https://www.twitter.com/JoeC4281"
  DLLdesc = "TCC Plugin Template written using Purebasic"
  DLLfuns = "Dummy,@Reverse,@PlusOne,_hello"
  
  pi\pszDll         = @DLLname
  pi\pszAuthor      = @DLLauth
  pi\pszEmail       = @DLLmail
  pi\pszWWW         = @DLLwww
  pi\pszDescription = @DLLdesc
  pi\pszFunctions    = @DLLfuns
  pi\nMajor.l       = 2021
  pi\nMinor.l       = 08
  pi\nBuild.l       = 27

  ProcedureReturn @pi
EndProcedure

; Command
ProcedureDLL.i Dummy(*lpszString)
  Static theString.s
  Static theValue.i
  
  theString = PeekS(*lpszString)
  
  If Len(theString) < 1
    wprintf("USAGE: Dummy <text>")
  Else
    theString = LTrim(RTrim(theString))
    wprintf(theString)
  EndIf
  
  ProcedureReturn #Null
EndProcedure

; Function
ProcedureDLL.i f_Reverse(*lpszString)
  Static theString.s
  Static theValue.i
  
  theString = PeekS(*lpszString)
  theString = ReverseString(theString)
  
  PokeS(*lpszString,theString)
  
  ProcedureReturn #Null
EndProcedure

; Function
ProcedureDLL.i f_PlusOne(*lpszString)
  Static theString.s
  Static theValue.i
  
  theString = PeekS(*lpszString)
  
  theValue = Val(theString)
  theValue = theValue + 1
  
  theString = Str(theValue)
  
  PokeS(*lpszString,theString)
  
  ProcedureReturn #Null
EndProcedure

; Internal Variable
ProcedureDLL.i _hello(*lpszString)
  PokeS(*lpszString,"Hello!")
  
  ProcedureReturn #Null
EndProcedure

I've attached the PBPlugin (plugin.dll) to this message.

Here's a .BTM that I used to test the plugin;
Code:
@setlocal
@echo off
if plugin pbplugin plugin /u pbplugin
plugin /l plugin.dll
plugin /i PBPlugin
echo @Reverse: %@PBPlugin$Reverse[Today]
echo @PlusOne: %@PlusOne[27]
echo _hello  : %_hello
Dummy Test
endlocal

Execution of said .BTM produced these results;
Code:
Module:      E:\Documents\PureBasic\tcc\2021-08-27\plugin.dll
Name:        PBPlugin
Author:      Joe Caverly
Email:       jlcaverlyca@yahoo.ca
Web:         https://www.twitter.com/JoeC4281
Description: TCC Plugin Template written using Purebasic
Implements:  Dummy,@Reverse,@PlusOne,_hello
Version:     2021.8  Build 27
@Reverse: yadoT
@PlusOne: 28
_hello  : Hello!
Test

Lord willing, I can now make a 64-bit version of my dbase plugin!

Joe
 

Attachments

  • pbplugin.zip
    3.8 KB · Views: 22
May 20, 2008
11,431
99
Syracuse, NY, USA
Commodore BASIC here. According to Edsger Dijkstra, I am now mentally mutilated beyond hope of regeneration.
Heehee! (again) I had to print out the Commodore's BASIC code for "African Safari" (or whatever it was called) to find out what the prize was and how to get it!
 
  • Like
Reactions: TEA-Time
May 20, 2008
11,431
99
Syracuse, NY, USA
P.S., I wasn't a gamer then and I'm not one now (except for the more than occasional Solitaire, Freecell, and Winmine (all imported from Windows 7).
 
Aug 23, 2010
637
9
The Basic Programming languages of today are closer to C than the Basic of 30 years ago.
It's just somebody effortlessly renamed language constructs to appear as another language.
rofl.gif
 
May 29, 2008
571
4
Groton, CT
Joe, the new DBF64 plugin is working well. I'd prefer comma as separator rather than space, but I could live with it the way it is.
 
May 29, 2008
571
4
Groton, CT
Joe,

The @recsize function appears to be returning a wrong value. It looks like it's reading a single byte for the length and ignoring the higher order byte.
I have a .dbf where the record size is 637, but @recsize tells me 125: a difference of 512. So, as a result, %@record[dbfname,recno] does not return correct data.
 
May 29, 2008
571
4
Groton, CT
I'll be testing it more fully tomorrow, but a quick check against the file I reported in my bug report now shows the correct record length 637.
Thanks for the quick action.
 
Last edited:
May 29, 2008
571
4
Groton, CT
I've done quite a bit of testing and I've found no problem. Thanks for supplying this plugin.
 
Similar threads
Thread starter Title Forum Replies Date
M (Stupid?) Problem with 64-bit 4Utils plugin... Plugins 3
Joe Caverly Plugin and 64-bit TCC Plugins 3
vefatica Can Sscanf read a 64-bit number? Plugins 2
fpefpe How to? Bytes or Chars (that is 16 bit chars) Plugins 1
vefatica 64-bit Onig library? Plugins 11
R New Plugin Plugins 0
Alpengreis elevated plugin questions Plugins 3
fpefpe utf-8 support in sdk/plugin api Plugins 4
S How to? Can @DU function in 4Utils64 plugin somehow cater for dirs with spaces? Plugins 3
vefatica Plugin access to arrays? Plugins 4
vefatica How big is a plugin's parameter buffer? Plugins 5
C @knownpath plugin Plugins 0
Charles Dye Updated OSD plugin Plugins 0
Joe Caverly C# plugin framework for JPSoft's TCC Plugins 0
dcantor Help for newest version of TEXTUTILS plugin Plugins 10
dcantor UISTUFF plugin missing help topic Plugins 12
M How to? Use SafeChars plugin... Plugins 2
dcantor Error in SAFECHARS plugin v 1.9.0 Plugins 2
dcantor Request for documentation for ISO8601 plugin Plugins 4
vefatica Possible with a plugin? Plugins 6
dcantor Inconsistency between textutils plugin and wrap utility Plugins 2
H Latest ISO8601 plugin? Plugins 1
Charles Dye New plugin: QKeys Plugins 34
S Plugin to quickly locate all files hard linked together Plugins 5
S Documentation Plugin everything.dll Plugins 5
newbie How to? Multi-plugin installation errors, Re: FedUtils8 Plugins 7
vefatica Plugin -> thread -> Command() -> Ctrl-C? Plugins 20
Charles Dye A weirdoid plugin question Plugins 6
M SafeChars plugin misbehaving... Plugins 3
M A weird error re a plugin... Plugins 0
vefatica Plugin dilemma Plugins 2
fpefpe Documentation Plugin API/SDK Plugins 3
C Looking for Vince's old 4UTILS plugin for TCMD v8 Plugins 1
S DESKTOP plugin - anyone ? Plugins 0
C How to? a plugin to sort Outlook Express "rules" Plugins 0
M ISO Plugin: Yes, it's wonderful, but it could be yet more wonderful... Plugins 7
M The ISO plugin is wonderful, but it lacks a little something... Plugins 22
Charles Dye Beta plugin: HidePasswords Plugins 3
M ISO8601 Plugin not "reporting" errors to TCC... Plugins 4
Frank 4console plugin Plugins 4
S WAD ISO8601 Plugin Plugins 15
C Problem with FixNames plugin Plugins 9
dcantor Suggestion and request for DBF plugin Plugins 6
dcantor Suggestion for SafeChars plugin Plugins 7
M Charles, I just installed the "new" SafeChars plugin, ... Plugins 5
M A problem with the SafeChars Plugin... Plugins 30
S WHICHWIN (sysutils plugin) Plugins 13
M A (presumbly pretty simple) SafeChars plugin request... Plugins 2
M A "SafeChars" plugin request... Plugins 2
S ISO 8601 plugin enhancement Plugins 6

Similar threads