Page 1 of 1

I need help with binding error

Posted: Thu Mar 14, 2019 4:31 am
by jpags.me
I have created a LiveCode builder that calls a function from a DLL file. I was able to successfully create the extension but then when I tried using the extension it produces an error "Unable to bind foreign handler test_new_lcb.Multiply_numbers" . My DLL file only returns a multiplied number or does only multiplication.

Can someone help me with this? What did I do wrong on my code? Thank you

This is my LCB file.

Code: Select all

library test_new_lcb

use com.livecode.engine
use com.livecode.foreign

foreign handler Multiply_numbers(in pNum1 as CInt, in pNum2 as CInt) returns CInt binds to "new_dll>multiply_numbers"


public handler testing_num(in p1,in p2) returns CInt
  
  unsafe
  
      return Multiply_numbers(p1,p2)
      
  end unsafe
  
end handler

end library

Re: I need help with binding error

Posted: Thu Mar 14, 2019 10:44 pm
by PaulDaMacMan
try adding the language indicator part of the binding string:
"c:new_dll>multiply_numbers" -- c is for C language

Re: I need help with binding error

Posted: Fri Mar 15, 2019 2:27 am
by jpags.me
I have created a C# DLL. Is that not supported? How can I bind a C# dll file?

Re: I need help with binding error

Posted: Fri Mar 15, 2019 9:51 pm
by PaulDaMacMan
jpags.me wrote:
Fri Mar 15, 2019 2:27 am
I have created a C# DLL. Is that not supported? How can I bind a C# dll file?
I'm not sure if C# is supported.
I know for sure that regular C, C++, Objective C, and Java are supported.

I think the FFI binding is based on this here (but I could be wrong):
https://github.com/libffi/libffi