Git Product home page Git Product logo

ffidl's People

Contributors

apnadkarni avatar fmqa avatar medranocalvo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ffidl's Issues

Ffidl does not work with Tcl/Tk 8.7.a5

Apply the following changes to make Ffidl work with Tcl/Tk 8.7.a5:

  1. Changed load functionality:
    Change line in pkgIndex.tcl to: package ifneeded Ffidl 0.8b0 [list load [file join $dir Ffidl08b0.dll]]
  2. Checking of Tcl_ObjTypes:
    Do not check pointers to pre-allocated Tcl_ObjTypes, but compare type names.

ffidl.zip

ffidlrt cannot be loaded from starkit

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.

Incorporate @ecky-l improvements

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?

You can use ffidl which is pack into tclkit by small changing.

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"
    }
}

I want to implement pointer-into-string and pointer-into-unicode without using ffidl_pointer_pun.

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
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.