Re: [Lazarus] Simple ipc server fatal error on start - 0xc000007b

2023-04-01 Thread Sven Barth via lazarus
Wayne Sherman via lazarus  schrieb am So.,
2. Apr. 2023, 02:45:

> On Fri, Mar 31, 2023 at 9:38 AM Bo Berglund wrote:
> > What I want to do is...use the D7 app to read a hardware device on
> command
> > and send the data to the Lazarus app.
>
> You probably don't need the extra complication of IPC, sockets, COM,
> or OLE automation.  Instead of creating a D7 app, build a D7 DLL which
> exports the function(s) you need.  Import the DLL function(s) to your
> Lazarus app and call them directly.
>

Since the Delphi code in question is 32-bit that will restrict the FPC code
to i386-win32.

Regards,
Sven

>
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Simple ipc server fatal error on start - 0xc000007b

2023-04-01 Thread Wayne Sherman via lazarus
On Fri, Mar 31, 2023 at 9:38 AM Bo Berglund wrote:
> What I want to do is...use the D7 app to read a hardware device on command
> and send the data to the Lazarus app.

You probably don't need the extra complication of IPC, sockets, COM,
or OLE automation.  Instead of creating a D7 app, build a D7 DLL which
exports the function(s) you need.  Import the DLL function(s) to your
Lazarus app and call them directly.
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Simple ipc server fatal error on start - 0xc000007b

2023-04-01 Thread Giuliano Colla via lazarus

Il 01/04/2023 14:50, Jean SUZINEAU via lazarus ha scritto:

You can uses pipes too, basically just two files no need of 
networking, one for reading (delphi to freepascal), one for 
writing(freepascal to delphi).


I made last year a small app to communicate with Audacity 
(https://www.audacityteam.org/) using a specific plugin 
(https://manual.audacityteam.org/man/scripting.html).


You can find there the unit/class which manages the communication:
https://github.com/jsuzineau/pascal_o_r_mapping/blob/TjsDataContexte/tools/jsAudacity/uAudacity.pas 



In my case I used pipes already created by Audacity.
For your problem I think it would be more appropriate to use FpPipe 
(although I personnaly never used it):


https://www.freepascal.org/docs-html/rtl/baseunix/fppipe.html

I think you will find something similar on Delphi 7 side.




I'm afraid that Jean Suzineau is right, except for the reference to 
FpPipe which is Unix specific.


Named pipes (or FIFO's) may be the simplest solution, in place of a 
bloated Indi10, useful if you need something quite complex, such as a 
securized web server , or of the tcp/ip sockets of NetChat.
Just a file you write on one side and read the on the other side. Two 
named pipes for bidirectional communication, if necessary.


You'll find a lot of examples just looking for Delphi pipes or Delphi 
named pipes on the web.

https://github.com/Poznamenany/Named_Pipes_in_Delphi
is just one for Delphi side (but it's ok also for Lazarus).

You may find useful the discussion here, to avoid common pitfalls:
https://forum.lazarus.freepascal.org/index.php?topic=44251.0

Giuliano

--
Do not do to others as you would have them do to you.They might have different 
tastes.

-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Simple ipc server fatal error on start - 0xc000007b

2023-04-01 Thread Jean SUZINEAU via lazarus
You can uses pipes too, basically just two files no need of networking, 
one for reading (delphi to freepascal), one for writing(freepascal to 
delphi).


I made last year a small app to communicate with Audacity 
(https://www.audacityteam.org/) using a specific plugin 
(https://manual.audacityteam.org/man/scripting.html).


You can find there the unit/class which manages the communication:
https://github.com/jsuzineau/pascal_o_r_mapping/blob/TjsDataContexte/tools/jsAudacity/uAudacity.pas

In my case I used pipes already created by Audacity.
For your problem I think it would be more appropriate to use FpPipe 
(although I personnaly never used it):


https://www.freepascal.org/docs-html/rtl/baseunix/fppipe.html

I think you will find something similar on Delphi 7 side.


--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Simple ipc server fatal error on start - 0xc000007b

2023-04-01 Thread Giuliano Colla via lazarus

Il 01/04/2023 10:53, Bo Berglund via lazarus ha scritto:


And I can use Indy10 sockets rather than the now since long deprecated
TTcpClient and TTcpServer components.

I guess I will save myself a lot of time doing this...
If I were you I'd take ten minutes to give it a try. Just compile, 
launch two instances, and type in one and see the message in the other. 
Then decide which way to go. AFAIK all the Internet servers and clients 
around the world are using tcp/ip and none of them Indi10
If Windows wants to connect reliably to Internet must provide a good 
implementation of the tcp/ip protocol, which is just exploited by the 
TTcpClient and TTcpServer components.


Giuliano

--
Do not do to others as you would have them do to you.They might have different 
tastes.

--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Simple ipc server fatal error on start - 0xc000007b

2023-04-01 Thread Giuliano Colla via lazarus

Il 01/04/2023 09:37, Bo Berglund via lazarus ha scritto:


Where are the "internet examples of Delphi 7" located?
Inside the Delphi7 installation or where? I can't find any.

By the name you write it looks to me (without having found the example) that it
is a*network*  application using TCP/IP sockets or the like.
I know this is a possibility but seems to be problematic since it implies that
the communication is via the LAN. What about situations when there is no network
connection?

The IPC as described seems to use internal messaging channels on the Windows
computer it runs on and not the network...


-- Bo Berglund Developer in Sweden


I have found it on the Kylix installation. But I did a quick search of 
Delphi NetChat and I found it immediately. It should be in the Demos 
folder. Demos->Internet->NetChat. You may also download it from 
Internet, where a Brazilian guy has made it available:

http://simbolussi.ddns.com.br:8088/TESTE%20DELPHI%207/Delphi7/Delphi7/Demos/Internet/NetChat/

Yes it is a network app, but it can be used locally, just by connecting 
both sides via localhost (i.e. 127.0.0.1), the loopback interface, which 
can be used whenever you want to connect TCP/IP server-client on the 
same machine. It's fundamental to test network apps locally before 
deploying it.
Just search for "windows localhost", and you'll get the Microsoft 
documentation about it:

https://learn.microsoft.com/en-us/windows/iot-core/develop-your-app/loopback
and other contributions which may be useful.

That way you'll be using tools which are widely used and tested, and not 
very special ones which may fail outside a particular environment.


Giuliano

--
Do not do to others as you would have them do to you.They might have different 
tastes.

-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Simple ipc server fatal error on start - 0xc000007b

2023-04-01 Thread Bo Berglund via lazarus
On Sat, 01 Apr 2023 09:37:00 +0200, Bo Berglund via lazarus
 wrote:

>On Sat, 1 Apr 2023 01:58:05 +0200, Giuliano Colla via lazarus
> wrote:
>
>>Among the internet examples of Delphi 7 you should find a small app named 
>>netchat,
>>which provides a basic IPC. It’s quite simple and bullet-proof. I’ve 
>>converted to 
>>Lazarus on Linux, and used as a base for my needs of IPC. 
>>But converting on the same Windows environment should be very simple, just 
>>using 
>>the Lazarus facilities. You may test it just as it is, and then adapt it to 
>>your needs. 
>>
>>Giuliano 

So I pulled out my Delphi7 CD (actually mounted the ISO copy of the CD) and
managed to find the demo you refer to.
It is as I suspected using the TCP/IP socket communications, but I guess this is
the way I have to go.
I can probably set it to only operate on the localhost interface so there is no
need to get packets out onto the LAN, which may or may not be available.

And I can use Indy10 sockets rather than the now since long deprecated
TTcpClient and TTcpServer components.

I guess I will save myself a lot of time doing this...


-- 
Bo Berglund
Developer in Sweden

-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Simple ipc server fatal error on start - 0xc000007b

2023-04-01 Thread Bo Berglund via lazarus
On Sat, 1 Apr 2023 01:58:05 +0200, Giuliano Colla via lazarus
 wrote:

>Among the internet examples of Delphi 7 you should find a small app named 
>netchat,
>which provides a basic IPC. It’s quite simple and bullet-proof. I’ve converted 
>to 
>Lazarus on Linux, and used as a base for my needs of IPC. 
>But converting on the same Windows environment should be very simple, just 
>using 
>the Lazarus facilities. You may test it just as it is, and then adapt it to 
>your needs. 
>
>Giuliano 
>
Where are the "internet examples of Delphi 7" located?
Inside the Delphi7 installation or where? I can't find any.

By the name you write it looks to me (without having found the example) that it
is a *network* application using TCP/IP sockets or the like.
I know this is a possibility but seems to be problematic since it implies that
the communication is via the LAN. What about situations when there is no network
connection?

The IPC as described seems to use internal messaging channels on the Windows
computer it runs on and not the network...


-- 
Bo Berglund
Developer in Sweden

-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Simple ipc server fatal error on start - 0xc000007b

2023-03-31 Thread Giuliano Colla via lazarus
Among the internet examples of Delphi 7 you should find a small app named 
netchat, which provides a basic IPC. It’s quite simple and bullet-proof. I’ve 
converted to Lazarus on Linux, and used as a base for my needs of IPC. But 
converting on the same Windows environment should be very simple, just using 
the Lazarus facilities. You may test it just as it is, and then adapt it to 
your needs. 
Giuliano 

Inviato da iPhone

> Il giorno 31 mar 2023, alle ore 18:39, Bo Berglund via lazarus 
>  ha scritto:
> 
> I am investigating the possibilities to use IPC between a Lazarus and a 
> Delphi7
> application running on Windows. I was discussing this on the Lazarus forum 
> where
> I got a tip to use SimpleIPC, which apparently is delivered with the Fpc
> compiler itself.
> 
> The tip was given in this post:
> https://forum.lazarus.freepascal.org/index.php/topic,62867.msg475663.html#msg475663
> 
> In that post is a link to a GitHub project which simplifies ipc usage by
> creating a dll packaging everything needed so that the dll could be used from
> other applications developed in other languages too. Sounds good to me.
> Here is the GitHub project url:
> https://github.com/z505/SimpleIPC-lib
> 
> So I downloaded this and using Lazarus 2.2.4 and Fpc 3.2.2 on Windows 10 x64 I
> did this:
> 1) opened the dll project and compiled the dll itself.
> 2) Opened the demo-lazarus\ipcclient project and compiled it
> 3) Opened the demo-lazarus\ipcserver project and compiled it
> 
> So now I could start the ipcclient app and it shows its form with a button to
> send data to the server. When I used it there was an error message about "not
> finding the server". To be expected, since I had not started the server...
> 
> So I next tried to start the server app, but it immediately shows an error box
> with the text:
> ---
> Application error
> The application was unable to start correctly (0xc07b).
> Click OK to close the application.
>   [OK]
> ---
> 
> I have tried various things like changing target for the dll and both
> applications to win32 (I have the cross for Win32 installed), but the exact 
> same
> happens.
> 
> And I have no idea whatsoever on where to look for a reason for this to 
> happen.
> 
> I have even put a breakpoint into the server code at the earliest point I 
> could
> find and started it from Lazarus, but get the same error dialog and no
> breakpoint reached...
> 
> I tried reading https://wiki.freepascal.org/SimpleIPC but got no idea from 
> that
> either...
> 
> What to do now?
> I am not clever enough to figure out if there is some error in the GitHub
> project. Not used to windows communications at all.
> 
> 
> What I want to do is to create an ipc link to a Delphi7 server app from a
> Lazarus/fpc client app to use the D7 app to read a hardware device on command
> and send the data to the Lazarus app.
> It is not possible to compile the D7 app on Lazarus because there is a device
> manufacturer's obj file involved and it is apparently of the wrong format for
> Lazarus/Fpc to use. It can be linked to in Delphi7 but not in Lazarus/Fpc.
> 
> Hence the D7<=ipc=>Lazarus IPC communication...
> 
> I really do hope this can be fixed so I can get the ipc comm line to the D7
> interfacing app working!
> 
> 
> -- 
> Bo Berglund
> Developer in Sweden
> 
> -- 
> ___
> lazarus mailing list
> lazarus@lists.lazarus-ide.org
> https://lists.lazarus-ide.org/listinfo/lazarus

-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Simple ipc server fatal error on start - 0xc000007b

2023-03-31 Thread Jean SUZINEAU via lazarus
Considering everything will run on Windows,  it could be easy to use COM 
/ OLE Automation:


- making your delphi part as COM Server

- connecting as client in your Lazarus app, so you can call directly 
objects and functions defined in the Delphi app.


There is a bit of stuff to learn about COM to complete this but it's 
well documented and directly available on both sides, Delphi and Lazarus.


--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Simple ipc server fatal error on start - 0xc000007b

2023-03-31 Thread Bo Berglund via lazarus
I am investigating the possibilities to use IPC between a Lazarus and a Delphi7
application running on Windows. I was discussing this on the Lazarus forum where
I got a tip to use SimpleIPC, which apparently is delivered with the Fpc
compiler itself.

The tip was given in this post:
https://forum.lazarus.freepascal.org/index.php/topic,62867.msg475663.html#msg475663

In that post is a link to a GitHub project which simplifies ipc usage by
creating a dll packaging everything needed so that the dll could be used from
other applications developed in other languages too. Sounds good to me.
Here is the GitHub project url:
https://github.com/z505/SimpleIPC-lib

So I downloaded this and using Lazarus 2.2.4 and Fpc 3.2.2 on Windows 10 x64 I
did this:
1) opened the dll project and compiled the dll itself.
2) Opened the demo-lazarus\ipcclient project and compiled it
3) Opened the demo-lazarus\ipcserver project and compiled it

So now I could start the ipcclient app and it shows its form with a button to
send data to the server. When I used it there was an error message about "not
finding the server". To be expected, since I had not started the server...

So I next tried to start the server app, but it immediately shows an error box
with the text:
---
Application error
The application was unable to start correctly (0xc07b).
Click OK to close the application.
   [OK]
---

I have tried various things like changing target for the dll and both
applications to win32 (I have the cross for Win32 installed), but the exact same
happens.

And I have no idea whatsoever on where to look for a reason for this to happen.

I have even put a breakpoint into the server code at the earliest point I could
find and started it from Lazarus, but get the same error dialog and no
breakpoint reached...

I tried reading https://wiki.freepascal.org/SimpleIPC but got no idea from that
either...

What to do now?
I am not clever enough to figure out if there is some error in the GitHub
project. Not used to windows communications at all.


What I want to do is to create an ipc link to a Delphi7 server app from a
Lazarus/fpc client app to use the D7 app to read a hardware device on command
and send the data to the Lazarus app.
It is not possible to compile the D7 app on Lazarus because there is a device
manufacturer's obj file involved and it is apparently of the wrong format for
Lazarus/Fpc to use. It can be linked to in Delphi7 but not in Lazarus/Fpc.

Hence the D7<=ipc=>Lazarus IPC communication...

I really do hope this can be fixed so I can get the ipc comm line to the D7
interfacing app working!


-- 
Bo Berglund
Developer in Sweden

-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus