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: 40
May 20, 2008
11,783
118
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,783
118
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
675
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
572
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
572
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
572
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
572
4
Groton, CT
I've done quite a bit of testing and I've found no problem. Thanks for supplying this plugin.
 

Similar threads