Skip to content
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

Swig %rename(...) not being respected #6

Closed
bikeNomad opened this issue Jun 21, 2012 · 1 comment
Closed

Swig %rename(...) not being respected #6

bikeNomad opened this issue Jun 21, 2012 · 1 comment

Comments

@bikeNomad
Copy link
Contributor

If I use %rename() in a Swig .i file, the resultant XML has the new identifiers in the sym_name attributes (and the original names in the name attributes). But ffi-swig-generator keeps the original names, despite the fact that FFI's attach_function() can take an alternative name.

A one-line change to lib/generator/function.rb can fix this:

diff --git a/lib/generator/function.rb b/lib/generator/function.rb
index 8a26dd2..1483485 100644
--- a/lib/generator/function.rb
+++ b/lib/generator/function.rb
@@ -21,7 +21,7 @@ module FFI
         params = get_params(@node).inject([]) do |array, node|
           array << Argument.new(:node => node, :typedefs => @typedefs).to_s
         end
-        @indent_str + "attach_function :#{@symname}, [ #{params.join(', ')} ], #{get_rtype}"
+        @indent_str + "attach_function :#{get_attr('sym_name')}, :#{@symname}, [ #{params.join(', ')} ], #{get_rtype}"
       end
       private
       def get_params(node)
@bikeNomad
Copy link
Contributor Author

issued pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant