Thursday, February 9, 2017

Luabind: Binding an overloaded class function

Consider the following code:


When run:

kuyu@ub16:~/dkuyu/Dropbox/practice/lua/luabind/overloaded_function$ cat test.lua 
package.loadlib('./overloaded_function.so', 'init')()
a = overloaded_function()
a:print_string(6)
kuyu@ub16:~/dkuyu/Dropbox/practice/lua/luabind/overloaded_function$ cat commands.bash 
#!/bin/bash
g++ overloaded_function.cpp -I/usr/include/lua5.2/ -c -fPIC
g++ -shared -Wl,--whole-archive -o overloaded_function.so overloaded_function.o -lluabind -Wl,--no-whole-archive
lua test.lua
kuyu@ub16:~/dkuyu/Dropbox/practice/lua/luabind/overloaded_function$ ./commands.bash 
print_string: 6

No comments:

Post a Comment