Just to add some extra thoughts:
If using the DL class, you dont really need to even pack arrays up, you could alternatively use DL::CPtr["Some String"]::to_i to obtain the pointer to the string / variable, and then you can pass the pointer directly to the dll where it is modified for whatever purpose and then of course, is available from within ruby in the form of the variable that you use for the pointer..
Example:
# DLL Constant DLL = DL::dlopen('Dekyde P2P') # Function Constants STARTUP = DL::CFunc.new(DLL['Startup'], DL::TYPE_INT) def startup my_ptr = DL::CPtr[@some_variable].to_i const_get(__method__::upcase)::call([my_ptr]) endNote: The above example assumes the startup function from the dll takes only a single pointer / string.
But yea, pack is also a way to do things...
Damn I love ruby code <3
If using the DL class, you dont really need to even pack arrays up, you could alternatively use DL::CPtr["Some String"]::to_i to obtain the pointer to the string / variable, and then you can pass the pointer directly to the dll where it is modified for whatever purpose and then of course, is available from within ruby in the form of the variable that you use for the pointer..
Example:
# DLL Constant DLL = DL::dlopen('Dekyde P2P') # Function Constants STARTUP = DL::CFunc.new(DLL['Startup'], DL::TYPE_INT) def startup my_ptr = DL::CPtr[@some_variable].to_i const_get(__method__::upcase)::call([my_ptr]) endNote: The above example assumes the startup function from the dll takes only a single pointer / string.
But yea, pack is also a way to do things...
Damn I love ruby code <3
Last edited by a moderator:
