/scapix

Scapix Language Bridge

Primary LanguageC++OtherNOASSERTION

Scapix Language Bridge

🇺🇦 If you like this project, please consider donating to one of the funds helping victims of russian aggression against Ukraine: ukraine.ua

Automatic, on the fly bindings from C++ to Java, Objective-C, Swift, Python, JavaScript (WebAssembly) and C#. Bridge code automatically generated directly from C++ header files, no need to manually maintain IDL definitions or bindings.

Scapix Bridge Intro

Integrating in CMake project

include(FetchContent)
FetchContent_Declare(
  cmodule
  URL "https://github.com/scapix-com/cmodule/archive/refs/tags/v1.0.42.tar.gz"
  URL_HASH SHA256=0fc5bb6bde3054664713bc9cba48f44a2f8af8fa2b94eb0da1031d5298f9ccf6
)
FetchContent_MakeAvailable(cmodule)

find_package(Scapix REQUIRED)

scapix_bridge_headers(
    chatlib
    "com.example.chat"
    "source/chat/contact.h"
    "source/chat/session.h"
    "source/chat/model.h"
)

Documentation

Examples:

Java Link

Modern C++17 wrapper for JNI:

  • type-safe APIs
  • automatic resource management
  • ZERO runtime overhead compared to manually written JNI code
  • automatic C++/Java type conversion for many standard types (std::string, std::vector, etc.)
  • automatic C++/Java exception tunneling
  • comes with pre-generated C++ headers for all JDK and Android Java APIs
  • automatically generate C++ headers for any Java code, including your own
#include <scapix/java_api/java/lang/System.h>
#include <scapix/java_api/java/util/Locale.h>
#include <scapix/java_api/java/text/DateFormatSymbols.h>

using namespace scapix::link::java;
using namespace scapix::java_api;

void test()
{
    // C++ objects are automatically converted to and from corresponding Java types.
    // This works for any type supported by scapix::link::java::convert<> interface,
    // which supports many STL types and can be extended for your own types.

    std::string version = java::lang::System::getProperty("java.version");
    std::vector<std::string> languages = java::util::Locale::getISOLanguages();
    std::vector<std::vector<std::string>> zone_strings = java::text::DateFormatSymbols::getInstance()->getZoneStrings();
    std::map<std::string, std::string> properties = java::lang::System::getProperties();
}

Java Link Documentation
Java Link Example

License

Please carefully read license agreement.

In short: If you comply with license agreement, you may use Scapix Language Bridge free of charge to build commercial and/or open source applications. You may NOT modify and/or redistribute the Scapix Language Bridge product itself.