LC Builder and 3rd Part DLLs under Windows

Trevor DeVore lists at mangomultimedia.com
Tue Aug 7 13:52:58 EDT 2018


Matthias,

I downloaded and installed the demo and was able to link to the DLL.

1. Create a folder named `TBarCode`.
2. In that folder create a `code/x86-win32` folder.
3. Copy the `TBarCode11.dll` and `zlib1.dll` (not positive this is
required) files from the Program Files(x86) folder (NOT the 64-bit
versions) and place in the `./code/x86-win32` folder.
4. Create a file in the `TBarCode` folder named `tbarcode.lcb`
5. Place the following script in the `tbarcode.lcb` file and save it.

```
library community.livecode.tbarcode

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

  metadata title is "TBarCode"
  metadata author is ""
  metadata version is "0.1.0"

  private foreign handler win_tbarcode_licenseMe(in pLicensee as
ZStringUTF16, in pKindOfLicense as CULong, in pNoOfLicenses as CULong, \
        in pKey as ZStringUTF16, in pProductID as CULong) \
        returns CULong binds to “c:TBarCode11>BCLicenseMeW!stdcall"


  public handler TestMe() returns String
    variable tError as Number

    unsafe
      put win_tbarcode_licenseMe("LicenseeName", 3, 1, "LicenseKey", 2023)
into tError
    end unsafe
    log tError
    return "success"
  end handler
end library
```

6. Open tbarcode.lcb in the Extension Builder and test it by pressing the
“Play” button on the bottom of the Extension Builder window.
7. In the Message Box run: `put TestMe()`

Assuming all is well you should see “success” appear with a “0” in the log
field. I didn’t verify that I used the correct types for pKindOfLicense,
pNoOfLicenses, and pProductId. I was just verifying that LCB would execute
a handler in the DLL.

Ask or docs you can look at the following two docs on the web:

https://github.com/livecode/livecode/blob/develop/docs/guides/LiveCode%20Builder%20Language%20Reference.md
https://github.com/livecode/livecode-ide/blob/develop/Documentation/guides/Extending%20LiveCode.md

They are available as guides in the IDE docs but I find it easier to scan
and search in the web browser.

Good luck!

-- 
Trevor DeVore
ScreenSteps
www.screensteps.com


On Tue, Aug 7, 2018 at 9:41 AM Matthias Rebbe via use-livecode <
use-livecode at lists.runrev.com> wrote:

> Hi Trevor,
>
> thank you very much for your offer.
>
> I am interested in using the Barcode SDK for Windows from TEC-IT.
> https://www.tec-it.com/en/download/tbarcode/Download.aspx <
> https://www.tec-it.com/en/download/tbarcode/Download.aspx>
>
> Regards,
>
> Matthias
>
>
>
> > Am 07.08.2018 um 16:23 schrieb Trevor DeVore via use-livecode <
> use-livecode at lists.runrev.com>:
> >
> > Matthias,
> >
> > Yes it is possible. I don't know of any 3rd party DLL examples. Can you
> > point me to a DLL you want to wrap? I may be able to put together the
> > skeleton of an LCB extension for you to get started with.
> >
> > --
> > Trevor DeVore
> > ScreenSteps
> > www.screensteps.com
> >
> > On Tue, Aug 7, 2018 at 5:33 AM Matthias Rebbe via use-livecode <
> > use-livecode at lists.runrev.com> wrote:
> >
> >> Hi,
> >>
> >> i make use of  the Widgets in LC 9 very often and i am really impressed
> >> what is possible with LCB.
> >> I have no deep knowledge of LCB, but if i understand correctly then LCB
> is
> >> able to call OS APIs, right?
> >>
> >> If so, is it also possible to call functions of a 3rd party DLL under
> >> Windows?
> >>
> >> I know there is a very nice but old example on Ken Ray´s page  how to
> use
> >> external DLLs  in LC,
> >>
> >> But now with LCB i would prefer LCB to do the complete “wrapping”.
> >>
> >> So would it be possible? And if so, are there any examples available
> >> already?
> >>
> >> Regards,
> >>
> >> Matthias
> >> _______________________________________________
> >> use-livecode mailing list
> >> use-livecode at lists.runrev.com
> >> Please visit this url to subscribe, unsubscribe and manage your
> >> subscription preferences:
> >> http://lists.runrev.com/mailman/listinfo/use-livecode
> > _______________________________________________
> > use-livecode mailing list
> > use-livecode at lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



More information about the use-livecode mailing list