Author Topic: Sending a message to another app  (Read 239 times)


  • New member
  • *
  • Posts: 7
Sending a message to another app
« on: August 13, 2019, 10:58:41 pm »
I have a Mac 64 bit FPC/Lazarus app. I have another app that I also wrote (in C). I need the two apps to be able to due very simple messaging to each other. Something like SendMessage on Windows. Not sharing data, just notifying the other app when something needs to be done. Sending a message with an integer parameter would be sufficient.

I’m looking for the simplest method to do this, does anyone have any suggestions?


  • Jr. Member
  • **
  • Posts: 59
Re: Sending a message to another app
« Reply #1 on: August 14, 2019, 01:28:36 am »
Not the most elegant solution, but both programs could have a "hotfolder" they monitor for message files. When they detect a file, they read the message and delete it.

Another similar approach is to used a shared sqlite db with a queue table that is has a "source" and "message" column (think file approach just inside of a db).

A third approach could use sockets/http server that each application hosts, then when one app needs to notify the other, a post request/write to socket can be done. A bit more complicated but doesn't involve polling something.

Just some suggestions, there's probably a better way, I'm just not a mac user.


  • Hero Member
  • *****
  • Posts: 8484
Re: Sending a message to another app
« Reply #2 on: August 14, 2019, 08:24:45 am »
Use pipes or better use ipc. See the simpleipc example in the fcl-process package.

A good overview is here: all of which can be done with Freepascal.
« Last Edit: August 14, 2019, 08:54:32 am by Thaddy »
Read the manuals and if you are a professional get a proper education in computer science. Makes the forum a lot cleaner.


  • Sr. Member
  • ****
  • Posts: 306
  • KISS principle / Lazarus 2.0.0 / FPC 3.0.4
Re: Sending a message to another app
« Reply #3 on: August 14, 2019, 01:01:44 pm »
I suggest messaging over UDP. Easy to progam, just write your simple protocol.
procedure mulu64(a, b: QWORD; out clo, chi: QWORD); assembler;
  mov rax, a
  mov rdx, b
  mul rdx
  mov [clo], rax
  mov [chi], rdx
(* Pointer game *) Inc(ptr, 1); (* vs *) ptr := ptr + 1;