IPC between Java and C++

后端 未结 3 520
心在旅途
心在旅途 2021-02-11 10:39

My goal here is to make two separate applications (one in Java and other in C++, both on the same machine) read from the same SQLite database. The C++ implementation already wor

3条回答
  •  [愿得一人]
    2021-02-11 11:26

    Not sure about the performance you need over the IPC but there are several approaches:

    1. use sockets
    2. use pipes
    3. use memorymappedfiles (using memorymappedfiles you will have a performance gain)

    In either case you will need a serializer/deserializer for the objects(data) you pass from java to c++ and viceversa.

    Depending on the data format you might need serializer/deserializer only on Java side. (e.g. you send out binary data that C++ will read without needing to decode it anymore). A good tutorial on how to use memorymapped file in java can be found here and in C++ you need to use mmap function.

提交回复
热议问题