GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - xplpc/xplpc: Cross Platform Lite Procedure Call - Support Linux, macOS, Windows, iOS, Android, Web Assembly, Flutter, Kotlin, Python and More

BranchesTags
Open more actions menu

Latest commit

 

History

1 Commit
1 Commit

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
c
c
 
 
cmake
cmake
 
 
conan/profiles
conan/profiles
 
 
conformance
conformance
 
 
core
core
 
 
cxx
cxx
 
 
docs
docs
 
 
extras/images
extras/images
 
 
flutter/plugin
flutter/plugin
 
 
jni/lib
jni/lib
 
 
kotlin
kotlin
 
 
objc/lib
objc/lib
 
 
python
python
 
 
swift
swift
 
 
wasm
wasm
 
 
.clang-format
.clang-format
 
 
.editorconfig
.editorconfig
 
 
.gitignore
.gitignore
 
 
.swiftformat
.swiftformat
 
 
.swiftlint.yml
.swiftlint.yml
 
 
AGENTS.md
AGENTS.md
 
 
Brewfile
Brewfile
 
 
CMakeLists.txt
CMakeLists.txt
 
 
LICENSE.md
LICENSE.md
 
 
README.md
README.md
 
 
conanfile.py
conanfile.py
 
 
detekt.yml
detekt.yml
 
 
mypy.ini
mypy.ini
 
 
requirements.txt
requirements.txt
 
 
ruff.toml
ruff.toml
 
 
xplpc.py
xplpc.py
 
 

Repository files navigation

XPLPC Logo
XPLPC - Cross Platform Lite Procedure Call

Project

The XPLPC project connects languages and platforms, allowing for the transfer of serialized data between them. This is achieved without the need for a server, but instead by utilizing device memory. This approach is known as Lite Procedure Call.

One router lives in the C++ core for the whole process, and every language attaches to it as a layer. A layer registers the function names it serves, and a call from any language reaches the layer that registered that name last, so C++ can serve a name, an Android layer can take it over and a Flutter layer can take it from both, and when the Flutter layer goes away the name goes back to Android. Large buffers cross as a handle to bytes their owner registered, so they are neither copied nor encoded.

For example, you can call a procedure written in C++ code from a mobile application, or vice versa, with ease. This opens up a wide range of possibilities for developers and allows for a more seamless integration of different languages and platforms.

The XPLPC project needs no generator for the calls themselves, since a mapping is registered by name in plain code on every side. The one exception is Flutter, where filling an answer into a class of yours needs the reflection data reflectable's builder generates, which the Flutter guide describes. The library is added to an existing project without rewriting its code.

Using it from your own project

You do not need to copy this repository to build on it. Add it to your own CMake project with FetchContent or add_subdirectory, put your mappings into the xplpc target, define NativeLayer::initializePlatform to register them, and link xplpc::xplpc, and taking an update is moving one tag:

include(FetchContent)

FetchContent_Declare(xplpc GIT_REPOSITORY https://github.com/xplpc/xplpc.git GIT_TAG main-<commit>)
FetchContent_MakeAvailable(xplpc)

target_sources(xplpc PRIVATE src/NativeLayer.cpp)
target_link_libraries(app PRIVATE xplpc::xplpc)

cxx/consumer is a complete project built that way, and the C++ guide describes the options a consumer sets.

Workflow

XPLPC How It Works

How to use

Using C++ code:

auto request = Request{
    "sample.login",
    Param<std::string>{"username", "paulo"},
    Param<std::string>{"password", "123456"},
    Param<bool>{"remember", true},
};

Client::call<std::string>(request, [](const auto &response) {
    std::cout << "Returned Value: " << (response ? response.value() : "Empty") << std::endl;
});

Using Kotlin code:

val request = Request(
    "sample.login",
    Param("username", "paulo"),
    Param("password", "123456"),
    Param("remember", true)
)

Client.call<String>(request) { response ->
    println("Returned Value: $response")
}

Using Swift code:

let request = Request(
    "sample.login",
    Param("username", "paulo"),
    Param("password", "123456"),
    Param("remember", true)
)

Client.call(request) { (response: String?) in
    print("Returned Value: \(response ?? "")")
}

Using WASM with Typescript:

const request = new Request(
    "sample.login",
    new Param("username", "paulo"),
    new Param("password", "123456"),
    new Param("remember", true),
);

Client.call<string>(request).then((response : string | undefined) => {
    console.log("Returned Value: " + response);
});

Using Flutter with Dart:

var request = Request("sample.login", [
    Param("username", "paulo"),
    Param("password", "123456"),
    Param("remember", true),
]);

Client.call<String>(request, (response) {
    print("Returned Value: $response");
});

Using Python code:

request = Request(
    "sample.login",
    [
        Param("username", "paulo"),
        Param("password", "123456"),
        Param("remember", True),
    ],
)

Client.call(request, lambda response: print(f"Returned Value: {response}"), str)

Every language but C also has a waiting form of the same call, which is callAsync, or call_async in Python, and TypeScript has none of its own because call already answers with a promise. And every language has callSync, or call_sync in Python, which answers with the value itself when the mapping answered before it returned, and with the empty value when it did not. The guide for each language describes both, and the C guide shows the same thing done by hand over xplpc_call and xplpc_cancel.

Supported languages and platforms

  • C
  • C++
  • Kotlin (Android, Desktop)
  • Swift (iOS, macOS, tvOS, watchOS, Catalyst)
  • WebAssembly
  • Flutter (iOS, Android, Desktop)
  • Python

Documentation

  • General
  • Types
  • C
  • C++
  • Kotlin
  • Swift
  • WebAssembly
  • Flutter
  • Python
  • Dependency Manager
  • Contribution
  • Purpose

License

MIT

Copyright (c) 2022-2026, Paulo Coutinho

About

Cross Platform Lite Procedure Call - Support Linux, macOS, Windows, iOS, Android, Web Assembly, Flutter, Kotlin, Python and More

xplpc.github.io

Topics

cross-platformcxxjavascriptjnikotlinmobileprocedure-callpythonrpcswifttypescriptwebassembly

Resources

Readme
MIT license
Activity
Custom properties

Stars

49 stars

Watchers

2 watching

Forks

1 fork
Report repository

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.