i come very close to the solution, in fact it now runs okay in PB, but still i got errors calling the dll from thinbasic
PB DLL
#COMPILE DLL 'directs compiler to create DLL
FUNCTION Retain ALIAS "Retain" (st1 AS STRING,st2 AS STRING) EXPORT AS DWORD
DIM a AS STRING
DIM b AS STRING
a = st1: b = st2
DIM RSLT AS STRING
RSLT = RETAIN$(a, ANY b)
FUNCTION = STRPTR(RSLT)
END FUNCTION
PB 9.07 Code (which works):
#COMPILE EXE
DECLARE FUNCTION Retain LIB "dll_pb.dll" ALIAS "Retain" (st1 AS STRING, st2 AS STRING) AS DWORD
FUNCTION PBMAIN () AS LONG
DIM tst AS STRING
DIM tst2 AS STRING
DIM res AS DWORD
tst = "abgdhowz56uy"
tst2= "adoy6867"
res = Retain(tst, tst2)
ss$ = PEEK$(res, LEN(tst2))
MSGBOX (ss$)
END FUNCTION
the code output the characters ado6y it is all the characters of adoy6867 found in string abgdhowz56uy , it is really a great function, it is like a cleaner machine but works on letters.
thinbasic code: (does not work yet)
Declare Function Retain Lib "dll_pb.dll" Alias "Retain" (st1 As String, st2 As String) As DWord
Dim tst, tst2, ss As String
Dim res As DWord
tst = "abgdhowz56uy"
tst2= "adoy6867"
res = Retain(tst, tst2)
ss = Peek$(res, Len(tst2))
MsgBox (0,ss)
Bookmarks