Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Debian is like Suse with yast turned off, just better. :) -- Goswin Brederlow


devel / comp.lang.tcl / Re: Call Custom C ++ library in TCL scripts

SubjectAuthor
* Call Custom C ++ library in TCL scriptsLakshmi Ganesh
+* Re: Call Custom C ++ library in TCL scriptsRich
|`* Re: Call Custom C ++ library in TCL scriptsLakshmi Ganesh
| `- Re: Call Custom C ++ library in TCL scriptsRobert Heller
+- Re: Call Custom C ++ library in TCL scriptsChristian Gollwitzer
+- Re: Call Custom C ++ library in TCL scriptsJacob
`- Re: Call Custom C ++ library in TCL scriptsAshok

1
Call Custom C ++ library in TCL scripts

<9874a43d-a745-480f-ad3e-048657fa870fn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=21905&group=comp.lang.tcl#21905

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:6214:1845:b0:5e7:b6ad:3ddf with SMTP id d5-20020a056214184500b005e7b6ad3ddfmr4430993qvy.8.1682526168364;
Wed, 26 Apr 2023 09:22:48 -0700 (PDT)
X-Received: by 2002:a37:e307:0:b0:74e:509:844 with SMTP id y7-20020a37e307000000b0074e05090844mr4551979qki.8.1682526168125;
Wed, 26 Apr 2023 09:22:48 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Wed, 26 Apr 2023 09:22:47 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=2603:8080:1e00:34d8:48c7:c996:cb53:2109;
posting-account=eMhFBAoAAACWKGqtfeaUTj1hbCFIB2IP
NNTP-Posting-Host: 2603:8080:1e00:34d8:48c7:c996:cb53:2109
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9874a43d-a745-480f-ad3e-048657fa870fn@googlegroups.com>
Subject: Call Custom C ++ library in TCL scripts
From: lakshmiganesh.padmanaban@gmail.com (Lakshmi Ganesh)
Injection-Date: Wed, 26 Apr 2023 16:22:48 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1505
 by: Lakshmi Ganesh - Wed, 26 Apr 2023 16:22 UTC

Hello All,

I am relatively new to TCL, the topic I am exploring is that I would like to see whether we can call the methods from my custom c ++ library in TCL scripts. Is there any command available in TCL to call the method from external C ++ library. I am assuming this library has to be put along with the other TCL libraries.

Any réponse is much appreciated.

Thanks,
Ganesh.

Re: Call Custom C ++ library in TCL scripts

<u2bn5c$1fkur$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=21906&group=comp.lang.tcl#21906

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: rich@example.invalid (Rich)
Newsgroups: comp.lang.tcl
Subject: Re: Call Custom C ++ library in TCL scripts
Date: Wed, 26 Apr 2023 17:31:24 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <u2bn5c$1fkur$1@dont-email.me>
References: <9874a43d-a745-480f-ad3e-048657fa870fn@googlegroups.com>
Injection-Date: Wed, 26 Apr 2023 17:31:24 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="d3154a3a91efa2536e8ada3986e37d75";
logging-data="1561563"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18p/Q/qmNywRZhSKBCjNt5D"
User-Agent: tin/2.6.1-20211226 ("Convalmore") (Linux/5.15.19 (x86_64))
Cancel-Lock: sha1:O69ktG2gGG3ZV+nMnHb/kBsXbzE=
 by: Rich - Wed, 26 Apr 2023 17:31 UTC

Lakshmi Ganesh <lakshmiganesh.padmanaban@gmail.com> wrote:
> Hello All,
>
> I am relatively new to TCL, the topic I am exploring is that I would
> like to see whether we can call the methods from my custom c ++
> library in TCL scripts. Is there any command available in TCL to
> call the method from external C ++ library. I am assuming this
> library has to be put along with the other TCL libraries.

Tcl does not have a native foreign function interface.

The traditional way to do this is to write a small amount of C (or in
your case C++) glue to provide that interface between scripts and C (or
C++) functions.

However, there is a FFI extension:

https://wiki.tcl-lang.org/page/Ffidl

The wiki page does say the last update was 2018, so your mileage may
vary with it. The page also links to a couple other extensions.

Re: Call Custom C ++ library in TCL scripts

<415f5a28-59ac-440e-a855-7cc99d19be75n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=21907&group=comp.lang.tcl#21907

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:620a:1295:b0:74d:f86c:66c2 with SMTP id w21-20020a05620a129500b0074df86c66c2mr3354857qki.0.1682533080059;
Wed, 26 Apr 2023 11:18:00 -0700 (PDT)
X-Received: by 2002:a05:6214:a48:b0:5a5:c0d:b620 with SMTP id
ee8-20020a0562140a4800b005a50c0db620mr4296614qvb.1.1682533079640; Wed, 26 Apr
2023 11:17:59 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Wed, 26 Apr 2023 11:17:59 -0700 (PDT)
In-Reply-To: <u2bn5c$1fkur$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2603:8080:1e00:34d8:48c7:c996:cb53:2109;
posting-account=eMhFBAoAAACWKGqtfeaUTj1hbCFIB2IP
NNTP-Posting-Host: 2603:8080:1e00:34d8:48c7:c996:cb53:2109
References: <9874a43d-a745-480f-ad3e-048657fa870fn@googlegroups.com> <u2bn5c$1fkur$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <415f5a28-59ac-440e-a855-7cc99d19be75n@googlegroups.com>
Subject: Re: Call Custom C ++ library in TCL scripts
From: lakshmiganesh.padmanaban@gmail.com (Lakshmi Ganesh)
Injection-Date: Wed, 26 Apr 2023 18:18:00 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2303
 by: Lakshmi Ganesh - Wed, 26 Apr 2023 18:17 UTC

On Wednesday, April 26, 2023 at 12:31:29 PM UTC-5, Rich wrote:
> Lakshmi Ganesh <lakshmiganes...@gmail.com> wrote:
> > Hello All,
> >
> > I am relatively new to TCL, the topic I am exploring is that I would
> > like to see whether we can call the methods from my custom c ++
> > library in TCL scripts. Is there any command available in TCL to
> > call the method from external C ++ library. I am assuming this
> > library has to be put along with the other TCL libraries.
> Tcl does not have a native foreign function interface.
>
> The traditional way to do this is to write a small amount of C (or in
> your case C++) glue to provide that interface between scripts and C (or
> C++) functions.
>
> However, there is a FFI extension:
>
> https://wiki.tcl-lang.org/page/Ffidl
>
> The wiki page does say the last update was 2018, so your mileage may
> vary with it. The page also links to a couple other extensions.

Thank you very much for the pointer RIch !!!

Re: Call Custom C ++ library in TCL scripts

<u2c2ci$1hh4r$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=21909&group=comp.lang.tcl#21909

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: auriocus@gmx.de (Christian Gollwitzer)
Newsgroups: comp.lang.tcl
Subject: Re: Call Custom C ++ library in TCL scripts
Date: Wed, 26 Apr 2023 22:42:58 +0200
Organization: A noiseless patient Spider
Lines: 10
Message-ID: <u2c2ci$1hh4r$1@dont-email.me>
References: <9874a43d-a745-480f-ad3e-048657fa870fn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 26 Apr 2023 20:42:58 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="1bf31c7b408f1cb5de0adcd06f79385d";
logging-data="1623195"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18/GAUIpeC+hZUKTZdCsNBvIO4jdhOTFlo="
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.10.0
Cancel-Lock: sha1:bqPdXve6vEteJdHurnGZ9uxZ7tU=
In-Reply-To: <9874a43d-a745-480f-ad3e-048657fa870fn@googlegroups.com>
 by: Christian Gollwitzer - Wed, 26 Apr 2023 20:42 UTC

Am 26.04.23 um 18:22 schrieb Lakshmi Ganesh:
> I am relatively new to TCL, the topic I am exploring is that I would like to see whether we can call the methods from my custom c ++ library in TCL scripts. Is there any command available in TCL to call the method from external C ++ library. I am assuming this library has to be put along with the other TCL libraries.
>

You can use SWIG to write the glue code for: https://www.swig.org/ SWIG
can interface functions, classes, and (to some extent) templates.

Christian

Re: Call Custom C ++ library in TCL scripts

<ZLucnfenlvDJDtT5nZ2dnZfqn_adnZ2d@giganews.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=21910&group=comp.lang.tcl#21910

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!feeder1.feed.usenet.farm!feed.usenet.farm!tr1.eu1.usenetexpress.com!feeder.usenetexpress.com!tr1.iad1.usenetexpress.com!69.80.99.22.MISMATCH!Xl.tags.giganews.com!local-2.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Wed, 26 Apr 2023 21:10:44 +0000
MIME-Version: 1.0
From: heller@deepsoft.com (Robert Heller)
Organization: Deepwoods Software
X-Newsreader: TkNews 3.0 (1.2.15)
Subject: Re: Call Custom C ++ library in TCL scripts
In-Reply-To: <415f5a28-59ac-440e-a855-7cc99d19be75n@googlegroups.com>
References: <9874a43d-a745-480f-ad3e-048657fa870fn@googlegroups.com> <u2bn5c$1fkur$1@dont-email.me> <415f5a28-59ac-440e-a855-7cc99d19be75n@googlegroups.com>
Newsgroups: comp.lang.tcl
Content-Type: text/plain; charset="us-ascii"
Originator: heller@sharky4.deepsoft.com
Message-ID: <ZLucnfenlvDJDtT5nZ2dnZfqn_adnZ2d@giganews.com>
Date: Wed, 26 Apr 2023 21:10:44 +0000
Lines: 41
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-JeUxMWrBjM7U7+5akERbC9D23paYBo9mJNI+eV88HvnT5+TQJEjKlfrOLR0QosUzzUt9n+lZvC93LT+!n9yABRS/EhladQROsnqB9rIZ+4AhY08++O+jmdoDPmWct/BUF2nfu7ejO2dYZ1CUt5QjLTHILpPI!HhM=
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
 by: Robert Heller - Wed, 26 Apr 2023 21:10 UTC

At Wed, 26 Apr 2023 11:17:59 -0700 (PDT) Lakshmi Ganesh <lakshmiganesh.padmanaban@gmail.com> wrote:

>
> On Wednesday, April 26, 2023 at 12:31:29 PM UTC-5, Rich wrote:
> > Lakshmi Ganesh <lakshmiganes...@gmail.com> wrote:
> > > Hello All,
> > >
> > > I am relatively new to TCL, the topic I am exploring is that I would
> > > like to see whether we can call the methods from my custom c ++
> > > library in TCL scripts. Is there any command available in TCL to
> > > call the method from external C ++ library. I am assuming this
> > > library has to be put along with the other TCL libraries.
> > Tcl does not have a native foreign function interface.
> >
> > The traditional way to do this is to write a small amount of C (or in
> > your case C++) glue to provide that interface between scripts and C (or
> > C++) functions.
> >
> > However, there is a FFI extension:
> >
> > https://wiki.tcl-lang.org/page/Ffidl
> >
> > The wiki page does say the last update was 2018, so your mileage may
> > vary with it. The page also links to a couple other extensions.
>
>
> Thank you very much for the pointer RIch !!!

There is a program called "SWIG" (Simplified Wrapper and Interface Generator),
that can be "fed" a C or C++ header file and will generate a C or C++ source
file that will provide the "glue" code.

>
>

--
Robert Heller -- Cell: 413-658-7953 GV: 978-633-5364
Deepwoods Software -- Custom Software Services
http://www.deepsoft.com/ -- Linux Administration Services
heller@deepsoft.com -- Webhosting Services

Re: Call Custom C ++ library in TCL scripts

<u2c84n$1idm6$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=21911&group=comp.lang.tcl#21911

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: JacobLambeth@clevelandgolf.com (Jacob)
Newsgroups: comp.lang.tcl
Subject: Re: Call Custom C ++ library in TCL scripts
Date: Wed, 26 Apr 2023 15:21:11 -0700
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <u2c84n$1idm6$1@dont-email.me>
References: <9874a43d-a745-480f-ad3e-048657fa870fn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 26 Apr 2023 22:21:11 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="ad87b7c617fe3cd48204d6b1f5475278";
logging-data="1652422"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/8KdXLo9Fer2FUao1u1IUT0OVDSelzJiY="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.10.0
Cancel-Lock: sha1:+fL1pqUErr4idRUqnQRJNMBuPTM=
Content-Language: en-US
In-Reply-To: <9874a43d-a745-480f-ad3e-048657fa870fn@googlegroups.com>
 by: Jacob - Wed, 26 Apr 2023 22:21 UTC

On 4/26/2023 9:22 AM, Lakshmi Ganesh wrote:
> Hello All,
>
> I am relatively new to TCL, the topic I am exploring is that I would like to see whether we can call the methods from my custom c ++ library in TCL scripts. Is there any command available in TCL to call the method from external C ++ library. I am assuming this library has to be put along with the other TCL libraries.
>
> Any réponse is much appreciated.
>
> Thanks,
> Ganesh.

I found Ashok's CFFI package to work well.

https://cffi.magicsplat.com/

Re: Call Custom C ++ library in TCL scripts

<u2e3tp$1vi8l$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=21915&group=comp.lang.tcl#21915

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: apnmbx-public@yahoo.com (Ashok)
Newsgroups: comp.lang.tcl
Subject: Re: Call Custom C ++ library in TCL scripts
Date: Thu, 27 Apr 2023 20:51:28 +0530
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <u2e3tp$1vi8l$1@dont-email.me>
References: <9874a43d-a745-480f-ad3e-048657fa870fn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 27 Apr 2023 15:21:29 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="df23433d50efa82a0df296a0680cd8a8";
logging-data="2083093"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Khb5S1gWUO404ojEdMzn0"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.6.1
Cancel-Lock: sha1:ud31h/XvZZPeYn7FLsxPvijwzIo=
Content-Language: en-US
In-Reply-To: <9874a43d-a745-480f-ad3e-048657fa870fn@googlegroups.com>
 by: Ashok - Thu, 27 Apr 2023 15:21 UTC

On 4/26/2023 9:52 PM, Lakshmi Ganesh wrote:
> Hello All,
>
> I am relatively new to TCL, the topic I am exploring is that I would like to see whether we can call the methods from my custom c ++ library in TCL scripts. Is there any command available in TCL to call the method from external C ++ library. I am assuming this library has to be put along with the other TCL libraries.
>
> Any réponse is much appreciated.
>
> Thanks,
> Ganesh.

Does your library export a C++ API or a C API? Second, is the library a
shared library or static?

The ffidl/cffi solutions will only work well with shared libraries that
export a C API.

There is no standard C++ ABI (name mangling, parameter passing etc. all
can differ between compilers and even versions of the same compiler). So
if you are exporting a C++ API, then you will need to either write your
own wrapper or use SWIG (compiling with the same compiler as your library.)

/Ashok


devel / comp.lang.tcl / Re: Call Custom C ++ library in TCL scripts

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor