Lacking function in RingLibuv

25 views
Skip to first unread message

Mansour Ayouni

unread,
Aug 24, 2025, 7:06:08 PMAug 24
to The Ring Programming Language
Hello Mahmoud,

The function destroy_uv_sockaddr_in() is used in this sample at the end of the start() method:
but it's not implemented in the extension:

Therefore, when I use it in my code I get an undefined function error message.

All the best,
Mansour

Mansour Ayouni

unread,
Aug 24, 2025, 7:17:14 PMAug 24
to The Ring Programming Language
Hello Mahmoud,

I solved the issue by just nullifying the addr variable (addr = NULL) and escaping the function altogether.

Best,
Mansour

Mahmoud Fayed

unread,
Aug 24, 2025, 8:03:14 PMAug 24
to The Ring Programming Language
Hello Mansour

The related functions defined by the RingLibuv extension are

* new_sockaddr_in
* new_managed_sockaddr_in
* destroy_sockaddr_in

Thanks for the report :D

The documentation is updated in this commit:  Update Documentation - Using RingLibuv · ring-lang/ring@aca4593


>> "I solved the issue by just nullifying the addr variable (addr = NULL) and escaping the function altogether."

(1) If the structure memory is allocated using new_sockaddr_in() then using destroy_sockaddr_in() is important to avoid a memory leak.

(2) If the structure memory is allocated using new_managed_sockaddr_in() then no need to call destroy function and Ring VM will manage the pointer and free memory automatically (using reference counting)

Greetings,
Mahmoud

Mansour Ayouni

unread,
Aug 24, 2025, 8:20:59 PMAug 24
to Mahmoud Fayed, The Ring Programming Language
Hello Mahmoud,

Thank you for your prompt reply and useful information!

All the best,
Mansour

--

---
You received this message because you are subscribed to the Google Groups "The Ring Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ring-lang+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/ring-lang/19086bcc-e79b-44aa-8528-c0f1e5d232ban%40googlegroups.com.

Mahmoud Fayed

unread,
Aug 24, 2025, 8:21:35 PMAug 24
to The Ring Programming Language
Hello Mansour

You are welcome :D

Greetings,
Mahmoud

Reply all
Reply to author
Forward
0 new messages