What's the best form of IPC for two Windows C++ applications?

  • #1
I have two Windows Visual C++ programs that need fast inter-process communication. One is limited to 64-bit because it depends on 8 gigs of ram, and the other is limited to 32-bit because it depends on a proprietary 32-bit .dll

I need to send basically two integers from the 64-bit application to the 32-bit, and update a few times per second. Purely one-way communication.

Would opening the windows clipboard for writing in one process and reading in another work? What about just a simple file? Or would I run into file locking errors? Any better suggestions? I don't want to go and learn some new library or api unless it's absolutely necessary. Thoughts?
 

Answers and Replies

  • #2
rcgldr
Homework Helper
8,710
538
You can use semaphore and/or mutexes to sychronize access between tasks, but sharing handles to objects between tasks is an issue. The issue is passing an handle addresses for duplicatehandle() between tasks. One method is for the first task to allocate handles, and pass it's process id and handle addresses as command line parameters when invoking the second task. Using windows debugger functions it's possible for one task to read or write the memory of a second task, something commonly done by "trainers" for computer games. I've written some mult-threaded (shared memory space) apps, but not a multi-tasking (not shared memory space) app. A .dll has it's own memory space as well as access to the memory space of the calling task (I haven't tried this either).
 
  • #3
Hurkyl
Staff Emeritus
Science Advisor
Gold Member
14,916
19
The boost libraries (boost.org) include interprocess library that you might find useful. I haven't tried using it myself.
 
  • #4
319
37
I haven't checked out boost, so can't comment on that. If that doesn't pan out I'd try a memory-mapped file.
 
  • #5
harborsparrow
Gold Member
555
120
a memory-mapped file might work, where one program writes to it, and the other reads from it
 
  • #6
759
0
Have you tried creating a Ramdisk?
 
  • #7
Thanks for all the suggestions! I ended up making a simple file on the disk to write/read from. It's definitely not ideal, and sockets, or pipes or some of the other solutions seem faster, but I'm still getting read/write rates of 30 Hz (even when combined with frequent log file writes), which is more than enough for my application. No permission errors either. I just took the easy way out, and it is more than fast enough for my application.

Thanks!
 

Related Threads on What's the best form of IPC for two Windows C++ applications?

Replies
7
Views
4K
Replies
5
Views
4K
Replies
33
Views
212K
  • Last Post
Replies
2
Views
2K
  • Last Post
Replies
2
Views
3K
  • Last Post
Replies
0
Views
2K
  • Last Post
Replies
14
Views
3K
Replies
13
Views
661
Replies
3
Views
2K
Top