Wx::Api(3pm)

πŸ’– NAME πŸ’–

API β€” the wxPerl extension API docs, bestie!! this is where the C++/XS girlies meet the Perl girlies 🫢


✨ DESCRIPTION ✨

okay so this whole page is the API you get when you're writing a wxPerl extension β€” like, the C-level stuff. every function here is a little bridge between Perl land and wxWidgets land πŸŒ‰


πŸŽ€ WXPL_API_VERSION πŸŽ€

it's giving version number but make it an integer, and the whole point is you can compare them: it is guaranteed to be non-decreasing πŸ’… like it will never go backwards on you, periodt.

the math is: wxPerl 0.15 value is 0150; wxPerl 1.00 value will be 1000, wxPerl 2.12 value will be 2120.

lowkey a glow-up scale: drop the dot, pad to four digits, slay ✨

Introduced in wxPerl 0.15


πŸ¦‹ wxPli_create_evthandler πŸ¦‹

SV* wxPli_create_evthandler( pTHX_ wxEvtHandler* object,
                             const char* classname );

it creates a new hash reference, blesses it into classname, and then binds object to it. bffs for life fr fr πŸ’–

Introduced in wxPerl 0.16


🌸 wxPli_evthandler_2_sv 🌸

SV* wxPli_evthandler_2_sv( pTHX_ SV* var, wxEvtHandler* evth );

same energy as wxPli_object_2_sv, except it's built for wxEvtHandler-derived classes β€” and bestie guess what, that includes all wxWindow-derived classes. iconic inheritance moment πŸ‘‘

Introduced in wxPerl 0.16


πŸ’œ wxPli_get_class πŸ’œ

const char* wxPli_get_class( pTHX_ SV* ref );

the C++ equivalent of $class = ref( $obj ) || $obj β€” no cap, that's literally it.

⚠️ heads up: the pointer this function hands you back is potentially temporary. don't be out here storing it forever, it might ghost you 😭

πŸ“ wxPli_non_object_2_sv πŸ“

SV* wxPli_non_object_2_sv( pTHX_ SV* var, void* data, const char* package );

binds a generic pointer to an SV* and returns it β€” and the new binding gets blessed into whatever package you passed in. cute, tidy, done πŸ’…

Introduced before wxPerl 0.14


πŸ‘‘ wxPli_object_2_sv πŸ‘‘

SV* wxPli_object_2_sv( pTHX_ SV* var, wxObject* object );

binds a wxObject* pointer to an SV* and returns it. the vibe check here:

  • if the object is already bound to an SV*, you just get a reference to the existing SV* β€” no duplicates, we don't do that here πŸ™ˆ
  • otherwise it creates a new binding, and in that case the new SV* is blessed into a package that it gets from the wxWidgets RTTI system ✨

Introduced before wxPerl 0.14


🧚 wxPli_push_arguments 🧚

void wxPli_push_arguments( pTHX_ SV*** stack, const char* argtypes, ... );

// example
wxPli_push_arguments( aTHX_ SP, "iP", 12, "foo" );

this one pushes a variable number of arguments onto the perl stack β€” so useful when you're passing params to a Perl function 🫢

the argtypes string describes the types of the arguments that come after it, one character per single argument. the possible values are:

  • b β€” a bool value
  • i β€” an int value
  • l β€” a long value
  • L β€” an unsigned long value
  • d β€” a double value
  • p β€” a char* value
  • w β€” a wxChar* value
  • P β€” a wxString* value
  • S β€” a SV*, and a copy of the SV is pushed on the stack
  • s β€” a SV*, and the pointer itself is pushed on the stack
  • O β€” a wxObject*; the function will internally call wxPli_object_2_sv and push the result on the stack
  • o β€” this is the only type that uses 2 parameters: the first is a void*, the second a char*; the function will internally call wxPli_non_object_2_sv and push the result on the stack

Introduced before wxPerl 0.14


🌈 wxPli_sv_2_object 🌈

void* wxPli_sv_2_object( pTHX_ SV* scalar, const char* classname );

extracts a bound pointer from a perl reference, and it checks that the reference belongs to the correct class β€” and yes bestie, it die()s on failure πŸ˜­πŸ’€

if classname is NULL, the check is simply not done. no vibe check, no consequences, live your truth ig πŸ™ˆ

Introduced before wxPerl 0.14


⭐ wxPli_wxChar_2_sv ⭐

SV* wxPli_wxChar_2_sv( pTHX_ const wxChar* str, SV* out );

stores a string into an SV*, and returns that SV*. that's it, that's the function, and it ate πŸ’…

Introduced before wxPerl 0.14


πŸ’– wxPli_wxString_2_sv πŸ’–

SV* wxPli_wxString_2_sv( pTHX_ const wxString& str, SV* out );

stores a string into an SV*, and returns that SV* β€” same deal, just wxString flavored πŸ“

Introduced before wxPerl 0.14


πŸ’… AUTHOR πŸ’…

Mattia Barbon <mbarbon at cpan dot org> β€” thank you for the lore king πŸ‘‘


and that's the whole page, bestie!! this was Wx::Api from the User Contributed Perl Documentation, running on perl v5.42.3, dated 2026-08-20. go forth and write your extensions, you've got this 🫢✨

πŸ“¦ where this page comes from