support a C++ lib

31 views
Skip to first unread message

Smar

unread,
Oct 9, 2022, 1:31:01 AM10/9/22
to The Ring Programming Language
hello ring team,
I need your help. I am trying to support a C++ lib.

1-the first case is a function with multi paramerter like printf  (...)

 void  Text(const char* fmt, ...)  

2- function with array parameter
float col[3] makes problems. what can i write instead.

bool ColorEdit3(const char* label, float col[3], ImGuiColorEditFlags flags )

3 - a function with References parameter like : int& ref

void PushStyleVar(char idx, const char& val)
void PushStyleVar(ImGuiStyleVar idx, const ImVec2& val)

can someone please help how these functions will look in .CF file code generator

Ilir

unread,
Oct 9, 2022, 7:58:17 AM10/9/22
to The Ring Programming Language
Hello,

1-the first case is a function with multi paramerter like printf  (...)

 void  Text(const char* fmt, ...)  


You need to use <code> section (like in extern "C" case for RING_API void ringlib_init) where you define Ring function
making loop using RING_API_PARACOUNT to add varargs. In this case, first parameter is a string, rest is of variable size


2- function with array parameter
float col[3] makes problems. what can i write instead.


Arrays of the fixed size are usually given as Ring pointers (in this case float pointer), but you can also use OOP (check RingRaylib implementation)


3 - a function with References parameter like : int& ref

Reference is a fixed pointer (address is fixed), Ring pointers are used just like in case 2

Reply all
Reply to author
Forward
0 new messages