Giter VIP home page Giter VIP logo

Comments (9)

asticode avatar asticode commented on May 18, 2024

Your PR would be most welcome!

from go-astideepspeech.

lissyx avatar lissyx commented on May 18, 2024

@asticode I should be able to start working on that tomorrow, but I'd welcome any pointers / docs on how to properly expose structures and structures holding pointers to structures in Go, given my lack of knowledge in that language, any example / doc is useful :)

from go-astideepspeech.

asticode avatar asticode commented on May 18, 2024

Thing is, structures containing C attributes should be handled differently than structures containing Go attributes as far as I'm concerned.

I'd simply recommend using getters/setters to access/write C attributes withing Go structs.

You can also check out this link or this one to learn more about native Go structs.

If anyone else have ideas, we're all ears.

from go-astideepspeech.

lissyx avatar lissyx commented on May 18, 2024

Thing is, structures containing C attributes should be handled differently than structures containing Go attributes as far as I'm concerned.

I'd simply recommend using getters/setters to access/write C attributes withing Go structs.

Sounds like what I did for Rust bindings: RustAudio/deepspeech-rs@023dd85

from go-astideepspeech.

asticode avatar asticode commented on May 18, 2024

Yeah, sounds like the safest route!

from go-astideepspeech.

lissyx avatar lissyx commented on May 18, 2024

@asticode I'll first fix FreeString

from go-astideepspeech.

lissyx avatar lissyx commented on May 18, 2024

@asticode https://stackoverflow.com/questions/28925179/cgo-how-to-pass-struct-array-from-c-to-go I've found that, trying to use however does not lead to something working. Code is available at https://github.com/lissyx/go-astideepspeech/commits/expose-metadata

This slicing "seems" to work, in the sense that it compiles and runs, but trying to range over it, I always get the first item, and looking at pointers it is always the same.

from go-astideepspeech.

lissyx avatar lissyx commented on May 18, 2024

I always get the first item

That seems not true, I sometime get garbage, but always the same garbage value.

from go-astideepspeech.

lissyx avatar lissyx commented on May 18, 2024

Okay, nevermind, it seems like this was because there was no C defintion being included for C.struct_MetadataItem

from go-astideepspeech.

Related Issues (13)

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.