From Newsgroup: comp.lang.tcl
* Frizzus <
loic.canin@murena.io>
| Le 16/10/2025 |a 16:33, Robert Heller a |-crit-a:
| > At Thu, 16 Oct 2025 16:00:39 +0200 Ralf Fassel <
ralfixx@gmx.de> wrote:
| >
| >>
| >> * Frizzus <
loic.canin@murena.io>
| >> | % load ./liblst_raylib.so
| >> | cannot find symbol "Lst_raylib_Init":
| >> | /home/frizzus/Documents/code/Lime-Stained-Terracota/liblst_raylib.so:
| >> | undefined symbol: _Lst_raylib_Init
| >>
| >> As Robert pointed out, you need to provide that function in your
| >> extension module. See
| >>
https://wiki.tcl-lang.org/page/Hello+World+as+a+C+extension
| >> for an example. You need to adjust the Hello_Init() function to your
| >> library.
| > Yes, and it is important that the name match the library name. It
| > is possible
| > to override that with a second argument to the load command, but this is
| > discurraged.
| >
| thanks, the name of the library and the name of the Init function were
| not the same.
See the TCL 'load' manpage for details on the initialization function.
https://www.tcl-lang.org/man/tcl8.6/TclCmd/load.htm
You may specify a different prefix for the init-function, but even then
there are some restraints on the name (see manpage for details).
| I thought the "DLLEXPORT" symbol on the Init function definition was
| here to define this function as the entry point.
DLLEXPORT on some systems (notably Windows) has the meaning to 'export'
this function from the library so it may be called by code from outside
of the library. On these systems, DLLEXPORT is required for init-style functions, but functions declared as 'export' are not automatically
called.
| Is this a common pattern in dynamic library to have the entry function
| matching the library name ?
Calling the init-function in the way as described by the 'load' manpage
is TCL-specific.
HTH
R'
--- Synchronet 3.21a-Linux NewsLink 1.2