
Quote from Krakerman on November 1, 2021, 7:00 pmI d/l hpwDllCall plug-in and seems to work just using the already example of the PureBasic pure.dll but when I made just a simple change to the PureBasic source and re-compiled it to dll it's not working correctly.
Maybe because that was because the pure.dll was compiled with an older version of PureBasic? The newest version doesn't seem to work.
Not sure if anyone else has PureBasic to verify.
I d/l hpwDllCall plug-in and seems to work just using the already example of the PureBasic pure.dll but when I made just a simple change to the PureBasic source and re-compiled it to dll it's not working correctly.
Maybe because that was because the pure.dll was compiled with an older version of PureBasic? The newest version doesn't seem to work.
Not sure if anyone else has PureBasic to verify.

Quote from HPW on November 1, 2021, 9:58 pmHello,
Do you take the code from the link I posted in your other threads here?
https://archive.visualneo.com/viewtopic.php?f=3&t=14476&p=11223373&hilit=purebasic#p11223373
I have not tried it yet with the latest LTS-version of purebasic.
So post your used version or your purebasic code.
Regards
Hans-Peter
Hello,
Do you take the code from the link I posted in your other threads here?
https://archive.visualneo.com/viewtopic.php?f=3&t=14476&p=11223373&hilit=purebasic#p11223373
I have not tried it yet with the latest LTS-version of purebasic.
So post your used version or your purebasic code.
Regards
Hans-Peter

Quote from Krakerman on November 1, 2021, 10:13 pmYes I used your example code if you compile it to dll with the latest PureBasic it does not work and I tried both the x64 and x86 version of the PureBasic compiler.
I tested the compiled DLL within AutoHotKey and did a DLLCall and it works. Made me think that the pure.dll example was compiled possibly with an older PureBasic version.
Yes I used your example code if you compile it to dll with the latest PureBasic it does not work and I tried both the x64 and x86 version of the PureBasic compiler.
I tested the compiled DLL within AutoHotKey and did a DLLCall and it works. Made me think that the pure.dll example was compiled possibly with an older PureBasic version.

Quote from HPW on November 2, 2021, 7:42 pmHello,
As the old thread told, my last test was with Purebasic 5.62
Now I installed 5.73 LTS 32 bit over my previous 5.62.
I took the source and update it to puredemo573.pb
I create the new DLL. Its size in now 8KB. The 5.62 DLL was 7KB.
That new DLL is copied to the demo-directory of hpwDllCall (renamed to pure.dll)
Now the demo calls the both exported functions correctly.
I noticed that hpwDllCall does need some polish for its error handling. For example a wrong name of the DLL does not throw an error. hpwllCall is one of my early work an quite aged. ;-)
Regards
Hans-Peter
Hello,
As the old thread told, my last test was with Purebasic 5.62
Now I installed 5.73 LTS 32 bit over my previous 5.62.
I took the source and update it to puredemo573.pb
I create the new DLL. Its size in now 8KB. The 5.62 DLL was 7KB.
That new DLL is copied to the demo-directory of hpwDllCall (renamed to pure.dll)
Now the demo calls the both exported functions correctly.
I noticed that hpwDllCall does need some polish for its error handling. For example a wrong name of the DLL does not throw an error. hpwllCall is one of my early work an quite aged. ;-)
Regards
Hans-Peter
Uploaded files:
Quote from HPW on November 2, 2021, 7:43 pm; ; ------------------------------------------------------------ ; ; PureBasic - DLL example file for hpwDllCall ; ; 2018 - H.P.Wickern ; ; ------------------------------------------------------------ ; ; This example is a skeleton to build easely a DLL using PureBasic ; The dll is created in the 'Compilers' directory, under the ; 'purebasic.dll' name. An associated '.lib' is generated to use ; with LccWin32 or VisualC++. ; ; ; Rules to follow: ; - Never write code outside a procedure, except for variables ; or structure declaration. ; ; - DirectX Init routines must not be initialized in the the ; AttachProcess() procedure ; ; - There is 4 procedures automatically called: AttachProcess(), ; DetachProcess(), AttachThread() and DetachThread(). If you don't ; need them, just remove them. ; ; 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 Global *DllResult ; Real code start here.. ProcedureCDLL NeoFunc1(*String1.Ascii) theString.s = PeekS(*String1,-1,#PB_Ascii) MessageRequester("EasyRequester !", theString.s , #MB_ICONINFORMATION) EndProcedure ProcedureCDLL NeoFunc2(*String1.Ascii) theString.s = PeekS(*String1,-1,#PB_Ascii) Back.s = theString.s + " Purebasic Returnstring" ; MessageRequester("EasyRequester !", Back.s , #MB_ICONINFORMATION) *DllResult = Ascii(Back.s) ProcedureReturn *DllResult EndProcedure ProcedureCDLL FreeMem() FreeMemory(*DllResult) ; MessageRequester("FreeMem !", "Speicher freigegeben" , #MB_ICONINFORMATION) EndProcedure ; ExecutableFormat=Shared Dll ; Executable=C:\Programme\NeoBook\PlugIns\hpwDllCall\pure.dll ; EOF ; IDE Options = PureBasic 5.73 LTS (Windows - x86) ; ExecutableFormat = Shared dll ; CursorPosition = 42 ; FirstLine = 16 ; Folding = -- ; EnableXP ; Executable = pure_new.dll
;
; ------------------------------------------------------------
;
; PureBasic - DLL example file for hpwDllCall
;
; 2018 - H.P.Wickern
;
; ------------------------------------------------------------
;
; This example is a skeleton to build easely a DLL using PureBasic
; The dll is created in the 'Compilers' directory, under the
; 'purebasic.dll' name. An associated '.lib' is generated to use
; with LccWin32 or VisualC++.
;
;
; Rules to follow:
; - Never write code outside a procedure, except for variables
; or structure declaration.
;
; - DirectX Init routines must not be initialized in the the
; AttachProcess() procedure
;
; - There is 4 procedures automatically called: AttachProcess(),
; DetachProcess(), AttachThread() and DetachThread(). If you don't
; need them, just remove them.
;
; 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
Global *DllResult
; Real code start here..
ProcedureCDLL NeoFunc1(*String1.Ascii)
theString.s = PeekS(*String1,-1,#PB_Ascii)
MessageRequester("EasyRequester !", theString.s , #MB_ICONINFORMATION)
EndProcedure
ProcedureCDLL NeoFunc2(*String1.Ascii)
theString.s = PeekS(*String1,-1,#PB_Ascii)
Back.s = theString.s + " Purebasic Returnstring"
; MessageRequester("EasyRequester !", Back.s , #MB_ICONINFORMATION)
*DllResult = Ascii(Back.s)
ProcedureReturn *DllResult
EndProcedure
ProcedureCDLL FreeMem()
FreeMemory(*DllResult)
; MessageRequester("FreeMem !", "Speicher freigegeben" , #MB_ICONINFORMATION)
EndProcedure
; ExecutableFormat=Shared Dll
; Executable=C:\Programme\NeoBook\PlugIns\hpwDllCall\pure.dll
; EOF
; IDE Options = PureBasic 5.73 LTS (Windows - x86)
; ExecutableFormat = Shared dll
; CursorPosition = 42
; FirstLine = 16
; Folding = --
; EnableXP
; Executable = pure_new.dll

Quote from Krakerman on November 2, 2021, 8:03 pmDoes not work when compiled the example under 5.73 x64. I loaded the example dll into PureBasic compiled as dll using x64 not x86 to pure.dll and ran the demo and nothing happened when clicking the PureBasic demo button the debugger shows error
Does not work when compiled the example under 5.73 x64. I loaded the example dll into PureBasic compiled as dll using x64 not x86 to pure.dll and ran the demo and nothing happened when clicking the PureBasic demo button the debugger shows error


Quote from HPW on November 2, 2021, 8:33 pmHello,
You can not call DLL's compiled for X64 from an X86 enviroment!
Regards
Hans-Peter
Hello,
You can not call DLL's compiled for X64 from an X86 enviroment!
Regards
Hans-Peter

Quote from ilcaa72 on November 25, 2021, 1:11 amquestion, the plugin looks great. is it possible to use Python to create funcs/methods, etc compile into a .dll and use your plugin to access the functions? or is this plugin specific to certain languages? thanks for any help understanding how I can leverage my knowledge of Python to use this plugin
question, the plugin looks great. is it possible to use Python to create funcs/methods, etc compile into a .dll and use your plugin to access the functions? or is this plugin specific to certain languages? thanks for any help understanding how I can leverage my knowledge of Python to use this plugin

Quote from HPW on November 25, 2021, 9:09 amHello,
As far I know the python dll is written in C++ and not compatible with standard C-DLL's.
So no it is not specific for certain languages. It is specific to standard calling conventions derived from windows DLL's.
You may use a wrapper plugin to contect to python to have a bridge between the different calling conventions.
When you google for "delphi 7 python" you find code samples.
Of cource someone is needed to make an plugin out of that.
So we have various languages by plugin yet (newlisp, ruby, pdscript), is another one needed?
Is there enough demand to be attractive for an commencial plugin developer?
Regards
Hans-Peter
Hello,
As far I know the python dll is written in C++ and not compatible with standard C-DLL's.
So no it is not specific for certain languages. It is specific to standard calling conventions derived from windows DLL's.
You may use a wrapper plugin to contect to python to have a bridge between the different calling conventions.
When you google for "delphi 7 python" you find code samples.
Of cource someone is needed to make an plugin out of that.
So we have various languages by plugin yet (newlisp, ruby, pdscript), is another one needed?
Is there enough demand to be attractive for an commencial plugin developer?
Regards
Hans-Peter