LCB Newbie question on file placement

LiveCode Builder is a language for extending LiveCode's capabilities, creating new object types as Widgets, and libraries that access lower-level APIs in OSes, applications, and DLLs.

Moderators: LCMark, LCfraser

Post Reply
paul@researchware.com
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 135
Joined: Wed Aug 26, 2009 7:42 pm
Location: Randolph, MA USA
Contact:

LCB Newbie question on file placement

Post by paul@researchware.com » Mon Jan 09, 2023 11:12 pm

I have a 3rd party open source library I am trying to get a LCB wrapper around. Uncer LC 9.6.8, I have it working on macOS with built .dylib file in <mylibrary>/code/x86_64-mac/ folder. I.E. such as <mylibrary>/code/x86_64-mac/mylibrary.dylib. I have placed the corresponding Windows (32 bit) .dll file (same name, but with .dll extension) in <mylibrary>/code/x86-win32/mylibrary.dll

In my LCB code, I am referring to the libraries with (as a generic example):
foreign handler someAPI (<typed argument list>) \
returns optional <type> \
binds to "c:mylibrary>someAPI"

I have it working on macOS, but the same code does not work on Windows, returning "unable to load foreign library".

Do I have the path wrong to the .dll wrong? Is it that I am running the 64 version of LC 9.6.8, but am trying to use a 32 bit dll library?

Any pointers in the right direction are welcome...
Paul Dupuis
Researchware, Inc.

paul@researchware.com
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 135
Joined: Wed Aug 26, 2009 7:42 pm
Location: Randolph, MA USA
Contact:

Re: LCB Newbie question on file placement

Post by paul@researchware.com » Mon Jan 09, 2023 11:18 pm

A related question. If I am passing file paths to the FFI should I assume I need to use macOS delimters when on macOS (i.e /) and Windows delimiters when on Windows (i.e. \)?
Paul Dupuis
Researchware, Inc.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: LCB Newbie question on file placement

Post by mwieder » Tue Jan 10, 2023 2:45 am

From memory, I believe you're correct about the file path delimiters.

Re a 32-bit dll in a 64-bit environment, I'm not sure about either the placement or the feasibility.

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 1206
Joined: Thu Apr 11, 2013 11:27 am

Re: LCB Newbie question on file placement

Post by LCMark » Tue Jan 10, 2023 10:25 am

@paul:

Re file delimiters - it will depend on the thirdparty library's API but yes, almost all cross-platform libraries I have encountered expect native file paths for functions taking paths to files.

Re 32-bit/64-bit - 64-bit processes cannot load 32-bit shared libraries - this is true on every platform. So if you only have a 32-bit build of the dll, then you have to use the 32-bit version of the LiveCode engine.

paul@researchware.com
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 135
Joined: Wed Aug 26, 2009 7:42 pm
Location: Randolph, MA USA
Contact:

Re: LCB Newbie question on file placement

Post by paul@researchware.com » Tue Jan 10, 2023 5:57 pm

Thank you. Using the Win32 version of LC9.6.8 the same code that worked on the macOS works on Windows (with the 32 bit .dll of the library). Okay, so now I guess I have to (re)learn how to actually compile C-something source on my computer to make a 64bit dll library.

All the answers were much appreciated.
Paul Dupuis
Researchware, Inc.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: LCB Newbie question on file placement

Post by mwieder » Tue Jan 10, 2023 6:03 pm

LOL.

And thanks for the confirmation, LCMark.

Post Reply

Return to “LiveCode Builder”