prs-de / ffidl Goto Github PK
View Code? Open in Web Editor NEWFfidl for Tcl8.6
Home Page: https://prs-de.github.io/ffidl/
License: Other
Ffidl for Tcl8.6
Home Page: https://prs-de.github.io/ffidl/
License: Other
See http://www.androwish.org/index.html/timeline?chng=jni/ffidl/*.
Must open a ticket.
Apply the following changes to make Ffidl work with Tcl/Tk 8.7.a5:
Hello,
If trying to [package require Ffidlrt 0.2] from a starkit and Tclkit, you get the error
couldn't load file "libFfidl0.7.so" : libFfidl0.7.so: cannot open shared object file: No such file or directory
while executing
"::ffidl::symbol [::ffidl::find-lib ffidl] ffidl_pointer_pun"
...
Reason are the calls to ::ffidl::symbol [::ffidl::find-lib ffidl]
in lines 307 and 308.
ffidl::find-lib
searches for the library in a directory, which is not possible within the VFS of a starkit. A solution would be to create a stubs table for ffidl itself, which exposes ffidl_pointer_pun
as stub function (see here on how to do this). Then use ffidl::stubsymbol
to resolve that function, rather than trying to resolve the symbol within the library itself with ffidl::symbol
.
Hello @ecky-l (writing the ticket here as there's no "Issues" in your fork). I've seen you've made many improvements to Ffidl in your fork. I'm keen on including them here. Would you like helping in doing that?
On Windows, you can use ffidl even if you pack ffidl into tclkit (built by KitCreator) by removing the directory name from the return string of find-pkg-lib function in ffidlrt.tcl.
Because Microsoft describes about LoadLibrary function that "if lpFileName does not include a path and there is more than one loaded module with the same base name and extension, the function returns a handle to the module that was loaded first".
(cf. https://msdn.microsoft.com/ja-jp/library/ms684175(v=vs.85).aspx )
Original (failed when "package require Ffidlrt"):
proc ::ffidl::find-pkg-lib {pkg} {
package require $pkg
foreach i [::info loaded {}] {
foreach {l p} $i {}
if {$p eq "$pkg"} {
return $l
}
}
# ignore errors when running under pkg_mkIndex:
if {![llength [info commands __package_orig]] } {
return -code error "Library for package $pkg not found"
}
}
Revised:
proc ::ffidl::find-pkg-lib {pkg} {
package require $pkg
foreach i [::info loaded {}] {
foreach {l p} $i {}
if {$p eq "$pkg"} {
return [file tail $l]
}
}
# ignore errors when running under pkg_mkIndex:
if {![llength [info commands __package_orig]] } {
return -code error "Library for package $pkg not found"
}
}
@recri, @ecky-l, @yanako: could you help testing the new beta https://github.com/prs-de/ffidl/releases/tag/0.8b0?
I think that Code1 at the end of ffidlrt.tcl can be replaced by Code2, but is there no problem?
Because I would like to statically link Ffidl with Tcl using Tcl_StaticPackage C-function.
Code1: (original)
::ffidl::callout ::ffidl::pointer-into-string {pointer} pointer-utf8 [::ffidl::symbol [::ffidl::find-lib ffidl] ffidl_pointer_pun]
::ffidl::callout ::ffidl::pointer-into-unicode {pointer} pointer-utf16 [::ffidl::symbol [::ffidl::find-lib ffidl] ffidl_pointer_pun]
Code2: (new)
::ffidl::callout ::ffidl::_pointer-into-string {pointer pointer int} pointer-utf8 [::ffidl::symbol [::ffidl::find-lib c] memcpy]
proc ::ffidl::pointer-into-string {pointer} {
::ffidl::_pointer-into-string $pointer 0 0
}
::ffidl::callout ::ffidl::_pointer-into-unicode {pointer pointer int} pointer-utf16 [::ffidl::symbol [::ffidl::find-lib c] memcpy]
proc ::ffidl::pointer-into-unicode {pointer} {
::ffidl::_pointer-into-unicode $pointer 0 0
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.