Kludge News

pzionpzion Moderator, Fabric Employee Posts: 118 Fabric Employee
edited February 9 in Kludge Auto-Wrapping Tool

Hi everyone,

I just wanted to give a quick update to say that Kludge is not dead, and in fact I've been back working on it over the past week or so. Here are some of the things are are currently happening:

  • We plan to include Kludge with Fabric starting with the next version 2.5.0. There isn't a planned release date for 2.5.0 at this point but we expect it will follow our usual release cadence. You can access the daily builds for the branch 'degas' that will be 2.5.0; they are at http://dist.fabricengine.com/FabricEngine/degas/. Kludge is already there in the daily builds.

  • My recent work has been to make Kludge produce a "two-level API" which allows a C++ API to be used at two levels: at a lower-level C++-like level as before, and at a higher-level KL level. This work is being done because, while the lower-level C++ API is excellent for providing an API with a lot of control and little overhead, it produces bindings that can be hard to use and that are poorly suited for generation of Canvas presets using kl2dfg. Here is an example:

If we have a global function void SetStdStringByRef(std::string &) in C++, Kludge will now wrap it with:

/// \dfgPresetOmit
CxxSetStdStringByRef(
    CxxStdStringRef _arg0
    ) = "StdString_SetStdStringByRef_c57e7d17e113639866c155de9224f469";

SetStdStringByRef(
    io String _arg0
    )
{
    CxxStdString ___arg0(_arg0);
    CxxStdStringRef _____arg0 = Make_CxxStdStringRef(___arg0);
    CxxSetStdStringByRef(
        _____arg0
        );
    _arg0 = String(___arg0);
}

The first function is a C++-level API function that allows you to work with a type called CxxStrString that is automatically generated by Kludge. You can instantiate values, which are simply an instance of std::string with a KL interface. You can get the site, append characters, and so on. You might want to work at this level if you are concerned about the cost of constantly converting KL strings to std::string and vice-versa

If you are not concerned about this cost, you can use the second interface. It automatically bridges the strings back an forth, so it looks more like a "plain" KL function. It is more user-friendly and better adapted for use with Canvas and kl2dfg. However, it will convert a string from KL to C++, and then from C++ to KL, with each call. This conversion cost may or may not matter; it depends entirely on the use case.

  • I know there are a lot of unanswered questions in this forum; my apologies. Once I'm finished the work described above I plan to review and answer, and hopefully address, the questions you've posted.

Peter Zion
Fabric Engine

Tagged:

Comments

Sign In or Register to comment.