{"id":18847845,"url":"https://github.com/interkosmos/fortran-tcl86","last_synced_at":"2026-01-24T09:32:55.815Z","repository":{"id":139286256,"uuid":"482954979","full_name":"interkosmos/fortran-tcl86","owner":"interkosmos","description":"Fortran 2018 interface bindings to Tcl/Tk 8.6","archived":false,"fork":false,"pushed_at":"2025-08-09T09:10:10.000Z","size":202,"stargazers_count":12,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-09T11:27:35.440Z","etag":null,"topics":["fortran","fortran-2018","fortran-package-manager","fpm","tcl","tcl-tk","tk"],"latest_commit_sha":null,"homepage":"","language":"Fortran","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/interkosmos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-04-18T18:32:00.000Z","updated_at":"2025-08-09T09:10:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"7d03e3d4-e571-47d0-b500-ade79a32e15c","html_url":"https://github.com/interkosmos/fortran-tcl86","commit_stats":{"total_commits":8,"total_committers":1,"mean_commits":8.0,"dds":0.0,"last_synced_commit":"b922690629ae26c7d33a85603e7ff94232895b12"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/interkosmos/fortran-tcl86","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interkosmos%2Ffortran-tcl86","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interkosmos%2Ffortran-tcl86/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interkosmos%2Ffortran-tcl86/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interkosmos%2Ffortran-tcl86/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/interkosmos","download_url":"https://codeload.github.com/interkosmos/fortran-tcl86/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interkosmos%2Ffortran-tcl86/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28723234,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-24T08:27:05.734Z","status":"ssl_error","status_checked_at":"2026-01-24T08:27:01.197Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fortran","fortran-2018","fortran-package-manager","fpm","tcl","tcl-tk","tk"],"created_at":"2024-11-08T03:09:51.203Z","updated_at":"2026-01-24T09:32:55.809Z","avatar_url":"https://github.com/interkosmos.png","language":"Fortran","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fortran-tcl86 – Tcl/Tk 8.6 for Fortran 2018\n\nA work-in-progress Fortran 2018 ISO_C_BINDING interface library for\ninteroperability with Tcl/Tk 8.6. This library allows you\n\n* to embed Tcl into Fortran,\n* to create Tcl extensions in Fortran (with Tcl Stubs),\n* to access (a subset of) the Tcl/Tk C API from Fortran,\n* to use Tcl as an evaluatable configuration file format, and\n* to add graphical user interfaces to Fortran programs.\n\nThere are some smaller differences to the original API:\n\n* Procedure names have been converted from camel case to snake case (for\n  example, `tcl_eval_ex()` in Fortran instead of `Tcl_EvalEx()` in C).\n* Character strings passed to library procedures do not have to be\n  null-terminated, as this step is done by Fortran wrappers.\n* Types are converted to their Fortran counter-parts (such as `logical` instead\n  of `c_int` for boolean values).\n* Some procedure arguments have been made optional to avoid passing of\n  `c_null_ptr`, `c_null_funptr`, and `0`.\n* The interfaces called by the wrapper procedures contain a trailing underscore\n  `_` in their name (for example, wrapper `tcl_eval()` appends a null character\n  to the second argument, then calls Fortran interface `tcl_eval_()`).\n* Functions and routines exposed to Tcl must have the `bind(c)` attribute.\n\nSee [COVERAGE](COVERAGE.md) for a table of the bound procedures.\n\n## Fortran Libraries\n\n| Library           | Description                                                      |\n|-------------------|------------------------------------------------------------------|\n| `libftcl86.a`     | Bindings to Tcl (`libtcl86`)                                     |\n| `libftclstub86.a` | Bindings to Tcl Stubs for extensions in Fortran (`libtclstub86`) |\n| `libftk86.a`      | Bindings to Tk (`libtk86`)                                       |\n\n## Build Instructions\n\nTcl 8.6 and Tk 8.6 with development headers have to be present. On FreeBSD,\ninstall the packages with:\n\n```\n# pkg install lang/tcl86 x11-toolkits/tk86\n```\n\nYou will also need a Fortran 2018 and a C compiler. Then, execute the provided\n`Makefile` to build the static Fortran interface libraries `libftcl86.a`,\n`libftclstub86.a`, and `libftk86.a`:\n\n```\n$ make\n```\n\nBy default, `gcc` and `gfortran` are used for compilation, but you can override\nthe settings:\n\n```\n$ make CC=icc FC=ifort\n```\n\nFurthermore, it is possible to build a single static library `libfortran-tcl86.a`\nwith [fpm](https://github.com/fortran-lang/fpm):\n\n```\n$ fpm build --profile=release --c-flag=\"`pkg-config --cflags tcl86`\"\n```\n\nThe include and library search paths in `--c-flags` have to point to the correct\ndirectories.\n\n## Linking Tcl \u0026 Tk\n\nLinking depends on whether Fortran is called from Tcl or Tcl from Fortran.  To\nbuild a Fortran program in `example.f90` that invokes the Tcl interpreter, link\nagainst `libftcl86.a -ltcl86`:\n\n```\n$ gfortran -I/usr/local/include/tcl8.6/ -L/usr/local/lib/tcl8.6/ \\\n  -o example example.f90 libftcl86.a -ltcl86\n$ ./example\n```\n\nThe include and library search paths as well as the name of the Tcl 8.6 library\nitself may have to be changed depending on your operating system (`-ltcl8.6`\ninstead of `-ltcl86` on Linux). Tcl/Tk can either be linked statically\n(`libtcl86.a`, `libtk86.a`) or dynamically (`-ltcl86`, `-ltk86`).\n\nTo create a shared library `libexample.so` with Tcl extensions written in\nFortran, run:\n\n```\n$ gfortran -DUSE_TCL_STUBS -fPIC -shared -o libexample.so `pkg-config --cflags tcl86` \\\n  example.f90 libftcl86.a libftclstub86.a `pkg-config --libs tcl86`\n```\n\nTo access the Tk toolkit from Fortran, link against `libftk86.a libftcl86.a\n-ltk86 -ltcl86` (or, use `pkg-config`):\n\n```\n$ gfortran -DUSE_TK_STUBS `pkg-config --cflags tk86` \\\n  -o example example.f90 libftk86.a libftcl86.a `pkg-config --libs tk86`\n$ ./example\n```\n\n## Example\n\nThe following basic example just invokes the Tcl interpreter from Fortran to\nevaluate a character string:\n\n```fortran\n! example.f90\nprogram main\n    use, intrinsic :: iso_c_binding, only: c_associated, c_ptr\n    use :: tcl\n    implicit none (type, external)\n\n    integer     :: rc\n    type(c_ptr) :: interp\n\n    ! Create Tcl interpreter.\n    interp = tcl_create_interp()\n    if (.not. c_associated(interp)) stop 'Error: Tcl_CreateInterp() failed'\n\n    ! Evaluate string as Tcl command.\n    rc = tcl_eval_ex(interp, 'puts \"Hello, from Tcl!\"')\n    if (rc /= TCL_OK) print '(\"Error: Tcl_EvalEx() failed\")'\n\n    ! Delete Tcl interpreter.\n    call tcl_delete_interp(interp)\nend program main\n```\n\nCompile and link the example with:\n\n```\n$ gfortran `pkg-config --cflags tcl86` -o example.f90 libftcl86.a `pkg-config --libs tcl86`\n$ ./example\nHello, from Tcl!\n```\n\n## Further Examples\n\nThe following example programs are provided:\n\n* **config** – Uses Tcl as a configuration file format (run `config`).\n* **dict** – Shows dictionary access (run `dict`).\n* **eval** – Evaluates a script in the Tcl interpreter (run `eval`).\n* **fs** – Tests Tcl file system API procedures (run `fs`).\n* **library** – Creates a Tcl extension `hello` inside a shared library (run `script.tcl`).\n* **link** – Demonstrates shared access to a variable between Tcl and Fortran (run `link`).\n* **namespace** – Creates a Tcl extension `::fortran::hello` (with namespace) inside a shared library (run `script.tcl`).\n* **re2c** – Shows a Tk window to convert temperature values by calling an extension written in Fortran (run `re2c`).\n\nTo build the examples, run:\n\n```\n$ make examples\n```\n\nChange to the directory of an example before executing it.\n\n## Licence\n\nISC\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finterkosmos%2Ffortran-tcl86","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finterkosmos%2Ffortran-tcl86","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finterkosmos%2Ffortran-tcl86/lists"}