Haiku-PyAPI: Python bindings for the Haiku API

I have been working on Python bindings for the Haiku API for a while,
and I think they are now somewhat usable.
All of the Application Kit is done, And of the Interface Kit,
BButton, BControl, BRect, BStringView, BTextControl, BView, BWindow and BFont is done.
the bindings are here, and here is a project I am doing with them.
Example: (Incomplete)

#!/bin/python3.9
from Be import *


should_close=True

class StartWindow(BWindow):
    def __init__(self):
        BWindow.__init__(
            self,
            BRect(100, 100, 250, 250),
            "Match It",
            B_TITLED_WINDOW_LOOK,
            B_NORMAL_WINDOW_FEEL,
            B_NOT_RESIZABLE | B_QUIT_ON_WINDOW_CLOSE,
        )
        START_MSG = int32(b"StBt")
        self.events = {START_MSG: self.start}
        self.start_msg = BMessage(START_MSG)
        self.panel = BView(self.Bounds(), "panel", 8, 20000000)
        self.label = BStringView(BRect(40, 30, 200, 50), "label", "Match It")
        font=be_plain_font
        font.SetSize(font.Size()+5)
        self.label.SetFont(font)
        self.start_button = BButton(
            BRect(40, 90, 100, 50), "start_button", "Start", self.start_msg
        )
        self.panel.AddChild(self.label, None)
        self.panel.AddChild(self.start_button, None)
        self.AddChild(self.panel, None)
        self.Show()

    def MessageReceived(self, msg):
        if msg.what in self.events:
            self.events[msg.what](msg)
        else:
            BWindow.MessageReceived(self, msg)
    

    def start(self, msg):
        global should_close
        print("Started!")
        should_close=False
        setupwindow=SetupWindow()
        self.Quit()

class SetupWindow(BWindow):
    def __init__(self):
        BWindow.__init__(
            self,
            BRect(100, 100, 450, 250),
            "Setup",
            B_TITLED_WINDOW_LOOK,
            B_NORMAL_WINDOW_FEEL,
            B_NOT_RESIZABLE | B_QUIT_ON_WINDOW_CLOSE,
        )
        OK_MSG = int32(b"OkBt")
        self.events = {OK_MSG: self.ok}
        self.ok_msg = BMessage(OK_MSG)
        self.panel = BView(self.Bounds(), "panel", 8, 20000000)
        #self.label_1 = BStringView(BRect(50, 10, 150, 30), "label 1", "Name Of Player 1")
        self.input_1 = BTextControl(BRect(50, 10, 250, 20), "input 1", "Name Of Player 1","player1",self.ok_msg)
        #be_plain_font.SetSize(be_plain_font.Size()-5)
        #self.input_1.SetFont(be_plain_font)
        self.ok_button = BButton(
            BRect(40, 90, 100, 50), "ok_button", "Ok", self.ok_msg
        )
        self.panel.AddChild(self.input_1, None)
        self.panel.AddChild(self.ok_button, None)
        self.AddChild(self.panel, None)
        self.Show()

    def MessageReceived(self, msg):
        if msg.what in self.events:
            self.events[msg.what](msg)
        else:
            BWindow.MessageReceived(self, msg)
    

    def ok(self, msg):
        global should_close
        print("Started!")
        should_close=False
        self.Quit()

class MatchIt(BApplication):
    def __init__(self):
        BApplication.__init__(self, "application/x-matchit")
        startwindow = StartWindow()
    def QuitRequested(self):
        global should_close
        rtn = should_close
        if not should_close:
            should_close=True
        return rtn


def main():
    a = MatchIt()
    a.Run()


if __name__ == "__main__":
    main()
30 Likes

currently,
I am having a problem with my project (the example code),
where, for first window, closing works, and pressing the start button works.

it then goes to the next window,

where is has an error wether i close it or press ok.
for closing

Debug information for team /boot/system/bin/python3.9 (1058):
CPU(s): 4x Intel Coreā„¢ i7-3520M
Memory: 7.70 GiB total, 451.45 MiB used
Haiku revision: hrev56578+87 Aug  3 2023 06:14: (x86_64)

Active Threads:
	thread 1058: python3.9 (main)
	thread 1131: team 1058 debug task 
	thread 1114: w>Setup 
		state: Exception (Segment violation)

		Frame		IP			Function Name
		-----------------------------------------------
		00000000	0x5f575342	? 
			Unable to retrieve disassembly for IP 0x5f575342: address not contained in any valid image.
		0x7ffb458badf0	0x98ebcfe8de	BInvoker::SetMessage(BMessage*) + 0x1e 
		0x7ffb458bae10	0x98ebd34991	BControl::~BControl() + 0x61 
		0x7ffb458bae30	0x98ebd2825d	BButton::~BButton() + 0xd 
		0x7ffb458bae60	0x98ebdbe346	BView::~BView() + 0x76 
		0x7ffb458bae90	0x98ebdbe318	BView::~BView() + 0x48 
		0x7ffb458baeb0	0x98ebdbe43d	BView::~BView() + 0xd 
		0x7ffb458baf10	0x98ebdc6086	BWindow::~BWindow() + 0xb6 
		0x7ffb458baf30	0x11ec5c658b7	PyBWindow::~PyBWindow() + 0x25 
		0x7ffb458baf50	0x11ec5c658d3	PyBWindow::~PyBWindow() + 0x13 
		0x7ffb458baf90	0x98ebd025f0	BLooper::Quit() + 0x180 
		0x7ffb458bb050	0x98ebd02693	BLooper::_QuitRequested(BMessage*) + 0x33 
		0x7ffb458bb0e0	0x98ebdc561b	BWindow::task_looper() + 0x1cb 
		0x7ffb458bb100	0x98ebd0215d	BLooper::_task0_(void*) + 0x1d 
		0x7ffb458bb120	0xcc238f9e06	thread_entry + 0x16 
		00000000	0x7fdf8f52a258	commpage_thread_exit + 0 

for ā€˜Okā€™:

Debug information for team /boot/system/bin/python3.9 (2133):
CPU(s): 4x Intel Coreā„¢ i7-3520M
Memory: 7.70 GiB total, 1.46 GiB used
Haiku revision: hrev56578+87 Aug  3 2023 06:14: (x86_64)

Active Threads:
	thread 2133: python3.9 (main)
	thread 2159: team 2133 debug task 
	thread 2158: w>Setup 
		state: Exception (Segment violation)

		Frame		IP			Function Name
		-----------------------------------------------
		00000000	0x10a05f414354	? 
			Unable to retrieve disassembly for IP 0x10a05f414354: address not contained in any valid image.
		0x7faa6712d2d0	0x12f7a4c98de	BInvoker::SetMessage(BMessage*) + 0x1e 
		0x7faa6712d2f0	0x12f7a4ff991	BControl::~BControl() + 0x61 
		0x7faa6712d310	0x12f7a4f325d	BButton::~BButton() + 0xd 
		0x7faa6712d340	0x12f7a589346	BView::~BView() + 0x76 
		0x7faa6712d370	0x12f7a589318	BView::~BView() + 0x48 
		0x7faa6712d390	0x12f7a58943d	BView::~BView() + 0xd 
		0x7faa6712d3f0	0x12f7a591086	BWindow::~BWindow() + 0xb6 
		0x7faa6712d410	0x158fe6208b7	PyBWindow::~PyBWindow() + 0x25 
		0x7faa6712d430	0x158fe6208d3	PyBWindow::~PyBWindow() + 0x13 
		0x7faa6712d470	0x12f7a4cd5f0	BLooper::Quit() + 0x180 
		0x7faa6712d490	0x158fe5f37bd	_ZZN8pybind1112cpp_functionC4Iv7BWindowJEJNS_4nameENS_9is_methodENS_7siblingEA1_cEEEMT0_FT_DpT1_EDpRKT2_ENKUlPS2_E_clESH_ + 0x63 
		0x7faa6712d4d0	0x158fe612966	_ZNO8pybind116detail15argument_loaderIJP7BWindowEE9call_implIvRZNS_12cpp_functionC4IvS2_JEJNS_4nameENS_9is_methodENS_7siblingEA1_cEEEMT0_FT_DpT1_EDpRKT2_EUlS3_E_JLm0EENS0_9void_typeEEESD_OSC_St16integer_sequenceImJXspT1_EEEOT2_ + 0x46 
		0x7faa6712d510	0x158fe60cf7c	_ZNO8pybind116detail15argument_loaderIJP7BWindowEE4callIvNS0_9void_typeERZNS_12cpp_functionC4IvS2_JEJNS_4nameENS_9is_methodENS_7siblingEA1_cEEEMT0_FT_DpT1_EDpRKT2_EUlS3_E_EENSt9enable_ifIXsrSt7is_voidISE_E5valueES6_E4typeEOT1_ + 0x3c 
		0x7faa6712d580	0x158fe5fc20e	_ZZN8pybind1112cpp_function10initializeIZNS0_C4Iv7BWindowJEJNS_4nameENS_9is_methodENS_7siblingEA1_cEEEMT0_FT_DpT1_EDpRKT2_EUlPS3_E_vJSI_EJS4_S5_S6_S7_EEEvOS9_PFS8_SB_ESH_ENKUlRNS_6detail13function_callEE1_clESP_ + 0x106 
		0x7faa6712d5a0	0x158fe5fc30c	_ZZN8pybind1112cpp_function10initializeIZNS0_C4Iv7BWindowJEJNS_4nameENS_9is_methodENS_7siblingEA1_cEEEMT0_FT_DpT1_EDpRKT2_EUlPS3_E_vJSI_EJS4_S5_S6_S7_EEEvOS9_PFS8_SB_ESH_ENUlRNS_6detail13function_callEE_4_FUNESP_ + 0x18 
		0x7faa6712daa0	0x158fe50b430	pybind11::cpp_function::dispatcher(_object*, _object*, _object*) + 0x111b 
		0x7faa6712dac0	0xd5c259519b	cfunction_call + 0x3b 
		0x7faa6712db10	0xd5c2576010	_PyObject_MakeTpCall + 0x70 
		0x7faa6712dba0	0xd5c24c195e	method_vectorcall.cold + 0x7e 
		0x7faa6712dcd0	0xd5c25cb2b0	_PyEval_EvalFrameDefault + 0x4fe0 
		0x7faa6712dd00	0xd5c2576a1c	function_code_fastcall + 0x9c 
		0x7faa6712dd90	0xd5c2578134	method_vectorcall + 0x74 
		0x7faa6712dec0	0xd5c25c6707	_PyEval_EvalFrameDefault + 0x437 
		0x7faa6712def0	0xd5c2576a1c	function_code_fastcall + 0x9c 
		0x7faa6712df80	0xd5c25781d3	method_vectorcall + 0x113 
		0x7faa6712dfd0	0x158fe51bccc	pybind11::detail::simple_collector<(pybind11::return_value_policy)1>::call(_object*) const + 0x30 
		0x7faa6712e020	0x158fe5ea645	_ZNK8pybind116detail10object_apiINS_6handleEEclILNS_19return_value_policyE1EJRP8BMessageEEENS_6objectEDpOT0_ + 0x75 
		0x7faa6712e090	0x158fe5ea04e	PyBWindow::MessageReceived(BMessage*) + 0x76 
		0x7faa6712e120	0x12f7a59061b	BWindow::task_looper() + 0x1cb 
		0x7faa6712e140	0x12f7a4cd15d	BLooper::_task0_(void*) + 0x1d 
		0x7faa6712e160	0xd3fff89e06	thread_entry + 0x16 
		00000000	0x7ffb7f750258	commpage_thread_exit + 0 
5 Likes

@PulkoMandy can you help me?

No, otherwise I would have replied.

Oof, your project was hard to compile. I even had to comment some lines out from the python program to avoid compiling Font.cpp, which spat out a long string of error messages. But I managed to reproduce the error message.

After a while probing around, I figured out that making two duplicate ok_msg variables, one for the text box and the other for the ok button fixes the crash. After some thinking and research, this is my guess: the text box deletes ok_msg when the window closes and the ok button deletes ok_msg when the window closes. In other words, ok_msg gets freed twice!

Edit: Sent you a PR with a small fix to the build system. Might even be your first PR from somebody other than yourself :slight_smile:

5 Likes

Thank you!
What where the errors for Font.cpp?

Oh, about the PR, I actually had some changes from a few days ago that I hadnā€™t pushed, so I must have pushed a non-working state.

There are a lot. Here are the first few. Looks like itā€™s going to be fun to debug :smile:

Font.cpp: In function 'void pybind11_init_Font(pybind11::module_&)':
Font.cpp:92:47: error: cannot create pointer to reference member 'unicode_block_range::block'
   92 | .def_readwrite("block", &unicode_block_range::block, "")
      |                          ~~~~~~~~~~~~~~~~~~~~~^~~~~
Font.cpp:163:95: error: no match for call to '(const pybind11::detail::overload_cast_impl<const char*, int, unsigned int, float, BString>) (<unresolved overloaded function type>)'
  163 | .def("GetTruncatedStrings", py::overload_cast<const char *, int, unsigned int, float, BString>(&BFont::GetTruncatedStrings), "", py::arg("stringArray"), py::arg("numStrings"), py::arg("mode"), py::arg("width"), py::arg("resultArray"))
      |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /system/lib/python3.9/vendor-packages/pybind11/include/pybind11/detail/../attr.h:13,
                 from /system/lib/python3.9/vendor-packages/pybind11/include/pybind11/detail/class.h:12,
                 from /system/lib/python3.9/vendor-packages/pybind11/include/pybind11/pybind11.h:13,
                 from Font.cpp:1:
/system/lib/python3.9/vendor-packages/pybind11/include/pybind11/detail/../detail/common.h:1094:20: note: candidate: 'template<class Return> constexpr decltype (pf) pybind11::detail::overload_cast_impl<Args>::operator()(Return (*)(Args ...)) const [with Args = {const char*, int, unsigned int, float, BString}]'
 1094 |     constexpr auto operator()(Return (*pf)(Args...)) const noexcept -> decltype(pf) {
      |                    ^~~~~~~~
/system/lib/python3.9/vendor-packages/pybind11/include/pybind11/detail/../detail/common.h:1094:20: note:   template argument deduction/substitution failed:
Font.cpp:163:95: note:   mismatched types 'Return (*)(const char*, int, unsigned int, float, BString)' and 'void (BFont::*)(const char**, int32, uint32, float, char**) const' {aka 'void (BFont::*)(const char**, int, unsigned int, float, char**) const'}
  163 | .def("GetTruncatedStrings", py::overload_cast<const char *, int, unsigned int, float, BString>(&BFont::GetTruncatedStrings), "", py::arg("stringArray"), py::arg("numStrings"), py::arg("mode"), py::arg("width"), py::arg("resultArray"))
      |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Font.cpp:163:95: note:   mismatched types 'Return (*)(const char*, int, unsigned int, float, BString)' and 'void (BFont::*)(const char**, int32, uint32, float, BString*) const' {aka 'void (BFont::*)(const char**, int, unsigned int, float, BString*) const'}
Font.cpp:163:95: note:   couldn't deduce template parameter 'Return'
/system/lib/python3.9/vendor-packages/pybind11/include/pybind11/detail/../detail/common.h:1099:20: note: candidate: 'template<class Return, class Class> constexpr decltype (pmf) pybind11::detail::overload_cast_impl<Args>::operator()(Return (Class::*)(Args ...), std::false_type) const [with Class = Return; Args = {const char*, int, unsigned int, float, BString}]'
 1099 |     constexpr auto operator()(Return (Class::*pmf)(Args...), std::false_type = {}) const noexcept
      |                    ^~~~~~~~
/system/lib/python3.9/vendor-packages/pybind11/include/pybind11/detail/../detail/common.h:1099:20: note:   template argument deduction/substitution failed:
Font.cpp:163:95: note:   types 'Return (Class::)(const char*, int, unsigned int, float, BString)' and 'void (BFont::)(const char**, int32, uint32, float, char**) const' {aka 'void (BFont::)(const char**, int, unsigned int, float, char**) const'} have incompatible cv-qualifiers
  163 | .def("GetTruncatedStrings", py::overload_cast<const char *, int, unsigned int, float, BString>(&BFont::GetTruncatedStrings), "", py::arg("stringArray"), py::arg("numStrings"), py::arg("mode"), py::arg("width"), py::arg("resultArray"))
      |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Font.cpp:163:95: note:   types 'Return (Class::)(const char*, int, unsigned int, float, BString)' and 'void (BFont::)(const char**, int32, uint32, float, BString*) const' {aka 'void (BFont::)(const char**, int, unsigned int, float, BString*) const'} have incompatible cv-qualifiers
Font.cpp:163:95: note:   couldn't deduce template parameter 'Return'
/system/lib/python3.9/vendor-packages/pybind11/include/pybind11/detail/../detail/common.h:1105:20: note: candidate: 'template<class Return, class Class> constexpr decltype (pmf) pybind11::detail::overload_cast_impl<Args>::operator()(Return (Class::*)(Args ...) const, std::true_type) const [with Class = Return; Args = {const char*, int, unsigned int, float, BString}]'
 1105 |     constexpr auto operator()(Return (Class::*pmf)(Args...) const, std::true_type) const noexcept
      |                    ^~~~~~~~
/system/lib/python3.9/vendor-packages/pybind11/include/pybind11/detail/../detail/common.h:1105:20: note:   template argument deduction/substitution failed:
Font.cpp:163:95: note:   mismatched types 'const char' and 'const char*'
  163 | .def("GetTruncatedStrings", py::overload_cast<const char *, int, unsigned int, float, BString>(&BFont::GetTruncatedStrings), "", py::arg("stringArray"), py::arg("numStrings"), py::arg("mode"), py::arg("width"), py::arg("resultArray"))
      |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Font.cpp:163:95: note:   mismatched types 'const char' and 'const char*'
Font.cpp:163:95: note:   candidate expects 2 arguments, 1 provided
Font.cpp:164:94: error: no match for call to '(const pybind11::detail::overload_cast_impl<const char*, int, unsigned int, float, char*>) (<unresolved overloaded function type>)'
  164 | .def("GetTruncatedStrings", py::overload_cast<const char *, int, unsigned int, float, char *>(&BFont::GetTruncatedStrings), "", py::arg("stringArray"), py::arg("numStrings"), py::arg("mode"), py::arg("width"), py::arg("resultArray"))
      |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/system/lib/python3.9/vendor-packages/pybind11/include/pybind11/detail/../detail/common.h:1094:20: note: candidate: 'template<class Return> constexpr decltype (pf) pybind11::detail::overload_cast_impl<Args>::operator()(Return (*)(Args ...)) const [with Args = {const char*, int, unsigned int, float, char*}]'
 1094 |     constexpr auto operator()(Return (*pf)(Args...)) const noexcept -> decltype(pf) {
      |                    ^~~~~~~~
/system/lib/python3.9/vendor-packages/pybind11/include/pybind11/detail/../detail/common.h:1094:20: note:   template argument deduction/substitution failed:
Font.cpp:164:94: note:   mismatched types 'Return (*)(const char*, int, unsigned int, float, char*)' and 'void (BFont::*)(const char**, int32, uint32, float, char**) const' {aka 'void (BFont::*)(const char**, int, unsigned int, float, char**) const'}
  164 | .def("GetTruncatedStrings", py::overload_cast<const char *, int, unsigned int, float, char *>(&BFont::GetTruncatedStrings), "", py::arg("stringArray"), py::arg("numStrings"), py::arg("mode"), py::arg("width"), py::arg("resultArray"))
      |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Font.cpp:164:94: note:   mismatched types 'Return (*)(const char*, int, unsigned int, float, char*)' and 'void (BFont::*)(const char**, int32, uint32, float, BString*) const' {aka 'void (BFont::*)(const char**, int, unsigned int, float, BString*) const'}
Font.cpp:164:94: note:   couldn't deduce template parameter 'Return'
/system/lib/python3.9/vendor-packages/pybind11/include/pybind11/detail/../detail/common.h:1099:20: note: candidate: 'template<class Return, class Class> constexpr decltype (pmf) pybind11::detail::overload_cast_impl<Args>::operator()(Return (Class::*)(Args ...), std::false_type) const [with Class = Return; Args = {const char*, int, unsigned int, float, char*}]'
 1099 |     constexpr auto operator()(Return (Class::*pmf)(Args...), std::false_type = {}) const noexcept
      |                    ^~~~~~~~
/system/lib/python3.9/vendor-packages/pybind11/include/pybind11/detail/../detail/common.h:1099:20: note:   template argument deduction/substitution failed:
Font.cpp:164:94: note:   types 'Return (Class::)(const char*, int, unsigned int, float, char*)' and 'void (BFont::)(const char**, int32, uint32, float, char**) const' {aka 'void (BFont::)(const char**, int, unsigned int, float, char**) const'} have incompatible cv-qualifiers
  164 | .def("GetTruncatedStrings", py::overload_cast<const char *, int, unsigned int, float, char *>(&BFont::GetTruncatedStrings), "", py::arg("stringArray"), py::arg("numStrings"), py::arg("mode"), py::arg("width"), py::arg("resultArray"))
      |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Font.cpp:164:94: note:   types 'Return (Class::)(const char*, int, unsigned int, float, char*)' and 'void (BFont::)(const char**, int32, uint32, float, BString*) const' {aka 'void (BFont::)(const char**, int, unsigned int, float, BString*) const'} have incompatible cv-qualifiers
Font.cpp:164:94: note:   couldn't deduce template parameter 'Return'
/system/lib/python3.9/vendor-packages/pybind11/include/pybind11/detail/../detail/common.h:1105:20: note: candidate: 'template<class Return, class Class> constexpr decltype (pmf) pybind11::detail::overload_cast_impl<Args>::operator()(Return (Class::*)(Args ...) const, std::true_type) const [with Class = Return; Args = {const char*, int, unsigned int, float, char*}]'
 1105 |     constexpr auto operator()(Return (Class::*pmf)(Args...) const, std::true_type) const noexcept
      |                    ^~~~~~~~
/system/lib/python3.9/vendor-packages/pybind11/include/pybind11/detail/../detail/common.h:1105:20: note:   template argument deduction/substitution failed:
Font.cpp:164:94: note:   mismatched types 'const char' and 'const char*'
  164 | .def("GetTruncatedStrings", py::overload_cast<const char *, int, unsigned int, float, char *>(&BFont::GetTruncatedStrings), "", py::arg("stringArray"), py::arg("numStrings"), py::arg("mode"), py::arg("width"), py::arg("resultArray"))
      |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Font.cpp:164:94: note:   mismatched types 'const char' and 'const char*'
Font.cpp:164:94: note:   candidate expects 2 arguments, 1 provided

I think I fixed that already, try pulling my code from github.

The way I would fix this sort of errors is:
I would comment out line 92, after trying changing it to .def_readonly
and for line 163 and 164,
I would add , py::const_ to the parentheses after py::overload_cast
making 164
.def("GetTruncatedStrings", py::overload_cast<const char *, int, unsigned int, float, char *>(&BFont::GetTruncatedStrings, py::const_), "", py::arg("stringArray"), py::arg("numStrings"), py::arg("mode"), py::arg("width"), py::arg("resultArray"))

2 Likes

Congratulations, your commit fixed Font.cpp!

Ah, I have heard that template programming can give some pretty convoluted error messagesā€¦ Looks like itā€™s true.

One other compilation error remains:

View.cpp: In function 'void pybind11_init_View(pybind11::module_&)':
View.cpp:402:18: error: '_rule_' was not declared in this scope
  402 | m.def("_rule_", &_rule_, "", py::arg("r1"), py::arg("r2"), py::arg("r3"), py::arg("r4"));
      |                  ^~~~~~

By the way, Iā€™ve been thinking of rewriting the build system using Jamfiles. Is that ok or do you prefer Makefiles?

Well, I donā€™t have much experience with either, but I am more familiar with make.
About the error,
Have you pulled my updated code?

EDIT: Didnā€™t read your message properly.

Try commenting it out.

I was thinking of using Jam since its more the ā€œHaiku wayā€ (although it seems even most applications for Haiku using the Make build system) and since I wanted to get some more experience with it. Either way, a build system should make the code build faster.

Hee hee. Thatā€™s exactly what I did. Solution to all of lifeā€™s problems :smiley:

Well, please comment it, and try to keep it in one file,
because I have absolutely zero experience with jam.

Alright, will do :slight_smile:

Oh, by the way, BeMatched now looks exactly like your screenshot looks. No more extra lines that I had to comment out in the python program.

1 Like

Please send a PR or something.

For BeMatched? It works now because your commit fixed Font.cpp

I mean for the ok_msg thing

There you go :slight_smile:

I have the basic Jamfile which can build AppKit.so and InterfaceKit.so. Next is to get it to create the soft links to the libraries e.g. Button.so.

Question: Do you prefer to have two separate files AppKit.so and InterfaceKit.so or one big file Be.so? Edit: Or what about individually packaging them, e.g. Button.so is not a symlink but its own file? Or does it not matter which way I do it?

1 Like