what specifics are stopping you to use FPC/Laz ?I use software protection dongles originally from Rainbow Sentinel.
Or via simple oldschool MMF ....Thanks, I was writing my other response while you posted...
Demo attached.
Compile "Delphi32" folder first and run and press a button.
Compile "Lazarus64" folder second and run and press button.
Compare values inside the memo's.
On my Win10/64bit system it works.
Must be the differences of Obj File formats.Yes that is the case according to other experts.
COFF etc..
I've just choosen GUI for easier demonstration, it is no requirement. Anyway, you would need to poll to check for new data compared to old...Or via simple oldschool MMF ....Thanks, I was writing my other response while you posted...
Demo attached.
Compile "Delphi32" folder first and run and press a button.
Compile "Lazarus64" folder second and run and press button.
Compare values inside the memo's.
On my Win10/64bit system it works.
Grateful for examples like this with both ends!
I noticed that both of the sample applications were GUI style apps, is that a requirement for them to work?
I mean do they utilize the Windows message handler that requires a window to talk to?
The server in this case should not be visible (the Delphi7 app) while the client does have a visible form.
In fact one problem is how to start it running when the main app starts...
Also in principle there can be several instances of the client apps running at the same time, so does that work?
Do they get different MMF instances into the same server?
It is late now so I will test tomorrow..
WM_COPYDATAI dont think that sharing data between 32 and 64 bit works due different LPARAM sizes... but havent tested.
What about SimpleIPC?
https://wiki.freepascal.org/SimpleIPC
https://github.com/z505/SimpleIPC-lib
On Github there is a demo for Lazarus, and a separate demo for Delphi.
No mention of 32 vs 64-Bit though
I use software protection dongles originally from Rainbow Sentinel.Try converting the .obj (COFF) file to .o (ELF) with objconv:
There is an SDK to interface with the driver they provide, and it works in Delphi7.
But when I try to port even the simplest application from D7 to Fpc it won't build because the SDK provides an obj file that implements all the API calls into the driver and the obj file generates an error when linking...
I have even gotten an updated SDK from the company with a new obj file, but that too fails. The syntax check completes successfully but when I compile I get the linker error where Fpc does not get to grips with the obj file.
There are 2 different obj files depending on the type of Delphi compiler, one for 32 bit (like Delphi7) and one for 64 bit Delphi.
I stopped using Delphi before it went 64 bit so I cannot check it.
What about SimpleIPC?
https://wiki.freepascal.org/SimpleIPC
https://github.com/z505/SimpleIPC-lib
On Github there is a demo for Lazarus, and a separate demo for Delphi.
No mention of 32 vs 64-Bit though
It seems like it is a good way not to re-invent the wheel...
The issue I have but it can be tested I guess:
If I use this system for IPC, will it be able to communicate between 32 bit and 64 bit applications on Windows?
My only working comm case to the protection device is to use 32 bit Delphi7 as the server but my clients will obviously all be 64 bit since they are built with present day tools (normally Lazarus/Fpc).
Can a pipe or whatever it is called that it uses traverse the 32/64 bit border on Windows?
Well,
I tried to look at the Github link to get hold of any useful files but after going back and forth I get nowhere...
I simply do not understand how I could use any of this since there seems to be a dll file involved in all examples and nowhere any download or such for that dll file...
I cannot make anything out of the examples, something is clearly missing here.
Well,Look inside this file: https://github.com/z505/SimpleIPC-lib/blob/master/dynsimpleipc.lpr
I tried to look at the Github link to get hold of any useful files but after going back and forth I get nowhere...
I simply do not understand how I could use any of this since there seems to be a dll file involved in all examples and nowhere any download or such for that dll file...
I cannot make anything out of the examples, something is clearly missing here.
There is an SDK to interface with the driver they provide, and it works in Delphi7.
But when I try to port even the simplest application from D7 to Fpc it won't build because the SDK provides an obj file that implements all the API calls into the driver and the obj file generates an error when linking...
I noticed that both of the sample applications were GUI style apps, is that a requirement for them to work?
I mean do they utilize the Windows message handler that requires a window to talk to?
The server in this case should not be visible (the Delphi7 app) while the client does have a visible form.
WM_COPYDATAI dont think that sharing data between 32 and 64 bit works due different LPARAM sizes... but havent tested.
Thank you for that information, what I right now can confirm is that I am able to send from 64bit to 32bit but not from 32bit to 64bit.WM_COPYDATAI dont think that sharing data between 32 and 64 bit works due different LPARAM sizes... but havent tested.
There is no problem with that. WM_COPYDATA's data gets marshaled across process boundaries, and LPARAM handling is local to each process, so a 32bit process can freely send data to a 64bit process and vice versa. When sending, WM_COPYDATA takes in an LPARAM pointing to memory which is local to the sender, then the data gets marshaled to the other process, and the receiver gets an LPARAM pointing to memory which is local to the receiver. So LPARAM being different sizes is not a factor at all.
Thank you for that information, what I right now can confirm is that I am able to send from 64bit to 32bit but not from 32bit to 64bit.
(32bit built with Delphi, 64bit built with FreePascal/Lazarus)
I hope you have a little time to download my attachment and take a look on to help me figure out what I am doing wrong.
It is unusual for an SDK to provide only obj files, since those tend to be compiler-specific. Most SDKs provide DLLs so that they can be used different compilers.Hi Remy, long time no see!
That being said, since the objs are usable in your Delphi, I would suggest creating your own DLL in Delphi that uses the objs internally, and then use that DLL in FreePascal.
Now I do print more it results to find target is okay but nothing happen on 64bit.
:D :D :D and I thought I am somewhere doing wrong, I've now read more about that scenario here (https://lazarus.lazarus.freepascal.narkive.com/cqwl5U2z/patch-for-processing-wm-copydata-in-win32-bugid-9210)Now I do print more it results to find target is okay but nothing happen on 64bit.
This is a known issue in FreePascal/Lazarus (oh yeah, now I remember this. I did know this once, but forgot about it):
SendMessage WM_COPYDATA is not recognized by Program (https://forum.lazarus.freepascal.org/index.php?topic=3973.0)
SengMessage WM_COPYDATA . Target doesn't receive anything (https://forum.lazarus.freepascal.org/index.php?topic=21354.0)
The solution is to manually subclass the receiving window, using the Win32 API SetWindowLong/Ptr() (https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwindowlongptra) or SetWindowSubclass() (https://learn.microsoft.com/en-us/windows/win32/api/commctrl/nf-commctrl-setwindowsubclass) function, per MSDN: Subclassing Controls (https://learn.microsoft.com/en-us/windows/win32/controls/subclassing-overview). This is also documented in the Lazarus Wiki: Processing non-user messages in your window (https://wiki.lazarus.freepascal.org/Win32/64_Interface#Processing_non-user_messages_in_your_window[/url). The 2nd forum link above has code to demonstrate how to do this.
Now I do print more it results to find target is okay but nothing happen on 64bit.
But maybe I do misunderstand something so I ask for help :-*
How does that readme.txt help while I need to process "WM_COPYDATA = 74;" ?Now I do print more it results to find target is okay but nothing happen on 64bit.
But maybe I do misunderstand something so I ask for help :-*
Read lazarus\examples\messages\readme.txt
Use only messages >= LM_USERI am happy with the found solution and maybe the OP is happy too? O:-)
How does that readme.txt help while I need to process "WM_COPYDATA = 74;" ?Now I do print more it results to find target is okay but nothing happen on 64bit.
But maybe I do misunderstand something so I ask for help :-*
Read lazarus\examples\messages\readme.txtQuoteUse only messages >= LM_USERI am happy with the found solution and maybe the OP is happy too? O:-)
It explains why nothing happen on 64bit, but I didn't notice the 3rd page of discussion when I wrote that, so sorry for noise.No no, everything is okay with the bitness, that issue rely on the way the FPC/Lazarus developers decided to support Windows specific messages (they just don't :D)
It explains why nothing happen on 64bit, but I didn't notice the 3rd page of discussion when I wrote that, so sorry for noise.No no, everything is okay with the bitness, that issue rely on the way the FPC/Lazarus developers decided to support Windows specific messages (they just don't :D)
Being the tread creator (OP) I do not see how the project you posted can help me at all...How does that readme.txt help while I need to process "WM_COPYDATA = 74;" ?Now I do print more it results to find target is okay but nothing happen on 64bit.
But maybe I do misunderstand something so I ask for help :-*
Read lazarus\examples\messages\readme.txtQuoteUse only messages >= LM_USERI am happy with the found solution and maybe the OP is happy too? O:-)
*snip*What if you just write a simple console Delphi7 app, give the commands as a parameter and use its console output as the result?
My use case is:
1) A Lazarus 64 bit application, which needs to read from a USB connected device using a driver from the manufacturer.
But the mfg supplied SDK for Delphi does not work with Lazarus because the interface (an OBJ file) is not a COFF formated obj, which is the only type it seems like the FreePascal linker can read.
2) So I need to use a helper app written for Delphi7, which can read the USB and supply the data to the main Lazarus app.
This app needs to be able to receive commands from the main app on what to read from USB and then read and send back the result.
So there are two apps involved, one Delphi7 32 bit server console app and one Lazarus 64 bit main GUI app.
*snip*
There is only one program in the zipfile and it is also not Delphi7 compatible, complains about a number of properties in the memo when loaded into Delphi7.I just downloaded my own Zip and on my machine it shows me
What version of Delphi (32 bit) do you use?
complains about a number of properties in the memo when loaded into Delphi7.Since you are very detailed I can not help further.
Do I really have to make a network based server app using an Indy10 socket client/server pair?
---- EDIT -----
I have come to the conclusion that using TCP/IP sockets to communicate between the two apps is probably the better solution after all. At least if I will save myself from pulling my hair out...
I could probably limit the server to only listen on localhost so no external spying will be possible.