{"id":17113053,"url":"https://github.com/emmt/ydlwrap","last_synced_at":"2026-01-04T08:53:08.827Z","repository":{"id":33282626,"uuid":"36927301","full_name":"emmt/YDLWrap","owner":"emmt","description":"Yorick plugin to dynamically call compiled functions","archived":false,"fork":false,"pushed_at":"2022-03-15T07:41:11.000Z","size":76,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-29T05:41:42.143Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"SWIG","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/emmt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-05T10:40:01.000Z","updated_at":"2022-03-15T07:41:15.000Z","dependencies_parsed_at":"2022-08-17T19:00:25.586Z","dependency_job_id":null,"html_url":"https://github.com/emmt/YDLWrap","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emmt%2FYDLWrap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emmt%2FYDLWrap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emmt%2FYDLWrap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emmt%2FYDLWrap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emmt","download_url":"https://codeload.github.com/emmt/YDLWrap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245177284,"owners_count":20573074,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-10-14T17:02:37.598Z","updated_at":"2026-01-04T08:53:08.800Z","avatar_url":"https://github.com/emmt.png","language":"SWIG","funding_links":[],"categories":[],"sub_categories":[],"readme":"            __   ______  _  __        __\n            \\ \\ / /  _ \\| | \\ \\      / /_ __ __ _ _ __\n             \\ V /| | | | |  \\ \\ /\\ / /| '__/ _` | '_ \\\n              | | | |_| | |___\\ V  V / | | | (_| | |_) |\n              |_| |____/|_____|\\_/\\_/  |_|  \\__,_| .__/\n                                                 |_|\n\n**YDLWrap** is a [Yorick](http://github.com/LLNL/yorick/) plugin for dynamically\ncalling compiled functions.\n\nThe interface is *fast* -- I have measured an extra overhead of about 15\nnanoseconds on my laptop (Core i7 Q820 at 1.73GHz) for a simple function\ncall like `sin(x)` compared to the built-in version of the same function.\n\n\nEXAMPLE\n=======\n\nHere how you can call a function using the symbols compiled into the Yorick\nexcutable itself:\n```C\n// Load the plugin:\n#include \"dlwrap.i\"\n\n// Open the executable itself:\ndll = dlopen();\n\n// Create a function wrapper:\ndll_sin = dlwrap(dll, DL_DOUBLE, \"sin\", DL_DOUBLE);\n//                |    |          |      |\n//                |    |          |      `-- argument type\n//                |    |          `--------- symbol name\n//                |    `-------------------- return type\n//                `------------------------- dynamic module\n\n// Call the wrapper (like a Yorick function):\na = dll_sin(1.25);\n```\nOf course, you can use the function wrappers as many times as you want and\nopen a specific dynamic library.\n\n\nINSTALLATION\n============\n\nPrerequisites\n-------------\n\nYou need two external libraries: one for loading dynamic modules, one for\ndynamically calling compiled functions.\n\nFor loading dynamic modules, you can choose:\n- DLOPEN interface;\n- [LIBTOOL](http://www.gnu.org/software/libtool/) interface, for Debian\n  users:\n\n  ```sh\n  sudo apt-get install libltdl-dev\n  ```\n\n- PLAY interface (this is the Portability LAYer on top of which Yorick is\n  build; with this interface, unloading of modules is not possible).\n\nFor dynamically call compiled functions, you must use:\n- [FFCALL](http://www.haible.de/bruno/packages-ffcall.html), for Debian\n  users:\n\n  ```sh\n  sudo apt-get install libffcall1-dev\n  ```\n\n\nInstallation by editing \"Makefile\"\n----------------------------------\n\nEdit the file `Makefile` in the source directory as follows.\n\nTo use DLOPEN, add:\n- `-DHAVE_DLOPEN`     to macro `PKG_CFLAGS` in `Makefile`;\n- `-ldl`              to macro `PKG_DEPLIBS` in `Makefile`.\n\nTo use LIBTOOL, add:\n- `-DHAVE_LIBTOOL`    to macro `PKG_CFLAGS` in `Makefile`;\n- `-lltdl -ldl`       to macro `PKG_DEPLIBS` in `Makefile`.\n\nTo use FFCALL, add:\n- `-DHAVE_FFCALL`     to macro `PKG_CFLAGS` in `Makefile`;\n- `-lavcall`          to macro `PKG_DEPLIBS` in `Makefile`.\n\nAfter having edited the `Makefile`, use Yorick to update the paths:\n\n```sh\nyorick -batch make.i\n```\n\nThen compile the package (the \"install\" step is optional):\n\n```sh\nmake clean\nmake\nmake install\n```\n\nInstallation with \"configure\" script\n------------------------------------\n\nThe package comes with a script which can be used to configure the code for\ncompilation.  The script can be invoked in the source directory or from\nanother directory to separate sources from compiled files. This allows\nbuilding for different architectures from a single source tree.\n\nAssuming `$SRC_DIR` and `$BUILD_DIR` are the source and build directories\n(they can be the same), to configure, build and install the package do:\n\n```sh\nmkdir -p $BUILD_DIR\ncd $BUILD_DIR\n$SRC_DIR/configure --cflags='...' --deplibs='...'\nmake\nmake install\n```\n\nThe command:\n\n```sh\n$SRC_DIR/configure --help\n```\n\ncan be used for a short summary of the script usage.  The most important\noptions are `--cflags='...'` and `--deplibs='...'`.  The default values are\nempty unless the corresponding macros (`PKG_CFLAGS` and `PKG_DEPLIBS`) are\nset in the current Makefile.  Typically:\n\n- for the dynamic loader (nothing is needed if you want to stick with\n  Yorick own loader), to use DLOPEN, add:\n\n  - `-DHAVE_DLOPEN`     to the value of option `--cflags`\n  - `-ldl`              to the value of option `--deplibs`\n\n  to use LIBTOOL, add:\n\n  - `-DHAVE_LIBTOOL`    to the value of option `--cflags`\n  - `-lltdl -ldl`       to the value of option `--deplibs`\n\n- you must specify how to use FFCALL for calling dynamic functions, add:\n\n  - `-DHAVE_FFCALL`     to the value of option `--cflags`\n  - `-lavcall`          to the value of option `--deplibs`\n\nFor instance, to use LIBTOOL and FFCALL:\n\n```sh\n$SRC_DIR/configure \\\n    --cflags='-DHAVE_FFCALL -DHAVE_LIBTOOL' \\\n    --deplibs='-lavcall -lltdl -ldl'\n```\n\nWISH LIST\n=========\nSee file [`TODO.md`](./TODO.md).\n\nAUTHORS\n=======\n- [Éric Thiébaut](https://github.com/emmt)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femmt%2Fydlwrap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femmt%2Fydlwrap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femmt%2Fydlwrap/lists"}