Method: FFI::Library#function_names
- Defined in:
- lib/ffi/library.rb
#function_names(name, arg_types) ⇒ Array<String>
Note:
Function names on windows may be decorated if they are using stdcall. See
-
en.wikipedia.org/wiki/Name_mangling#C_name_decoration_in_Microsoft_Windows
-
msdn.microsoft.com/en-us/library/zxk0tw93%28v=VS.100%29.aspx
-
en.wikibooks.org/wiki/X86_Disassembly/Calling_Conventions#STDCALL
Note that decorated names can be overridden via def files. Also note that the windows api, although using, doesn’t have decorated names.
This function returns a list of possible names to lookup.
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
# File 'lib/ffi/library.rb', line 232 def function_names(name, arg_types) result = [name.to_s] if ffi_convention == :stdcall # Get the size of each parameter size = arg_types.inject(0) do |mem, arg| size = arg.size # The size must be a multiple of 4 size += (4 - size) % 4 mem + size end result << "_#{name.to_s}@#{size}" # win32 result << "#{name.to_s}@#{size}" # win64 end result end |