-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use & when passing function references to HashTable constructor #1728
base: master
Are you sure you want to change the base?
Conversation
@@ -285,7 +285,7 @@ private: | |||
|
|||
HashTable createHashTable() { | |||
import gtkc.glib; | |||
return new HashTable(g_str_hash, g_str_equal); | |||
return new HashTable(&g_str_hash, &g_str_equal); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ref is a keyword in function signatures, not in calls??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, if you need this then do it in the function call. I assume this error will propagate to other calls, right? Or is it context specific? If then then this is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HashTable is obviously not a Tilix type, the constructor we're calling here is GtkD's wrapper around g_hash_table_new
, we're giving it pointers to C functions (which g_str_hash
and _equal
are)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it seems this is the correct approach, I wish GtkD would provide more type safety.
ldc 1.16.0 complains about trying to call `g_str_hash` / `g_str_equal` with no arguments
/usr/local/include/d/object.d(3219,36): Error: cannot implicitly convert expression aa of type shared(ProcessStatus[int]) to const(shared(ProcessStatus)[int]) ../source/gx/tilix/terminal/monitor.d(46,46): Error: template instance object.values!(shared(ProcessStatus[int]), shared(ProcessStatus), int) error instantiating
Added patch for another problem with newer ldc (1.18.0):
|
b53c46c
to
2f9d050
Compare
From what it looks like, LDC builds Tilix just fine today, so I think GtkD added the necessary ref's to make this work. |
ldc 1.16.0 complains about trying to call
g_str_hash
/g_str_equal
with no arguments