Code Monkey home page Code Monkey logo

Comments (5)

Cykooz avatar Cykooz commented on September 24, 2024

why can't the function just return CString::new(path.as_os_str().as_bytes()).unwrap_or_default()

Because the structure OsStr returned by method as_os_str() does not implement method as_bytes(). This method is described in the trait OsStrExt. Declaration and implementation of this trait depends on the particular OS.

from libheif-rs.

Cykooz avatar Cykooz commented on September 24, 2024

I have added this code into path_to_cstring function:

    #[cfg(all(target_arch = "wasm32", target_os = "wasi"))]
    {
        use std::os::wasi::ffi::OsStrExt;
        CString::new(path.as_os_str().as_bytes()).unwrap_or_default()
    }

You can try to compile libheif-rs from the dev branch of this git-repo.

from libheif-rs.

storybehind avatar storybehind commented on September 24, 2024

When building dev branch by command cargo wasi build --release, many errors occur like below. Any idea?

libheif-rs-dev-wasi-build-err

from libheif-rs.

Cykooz avatar Cykooz commented on September 24, 2024

I don't know. Could you look at bindings.rs file somewhere inside target/wasm32-wasi/release/build/libheif-sys-*/out/ directory?
This file generates by bindgen crate from headers-file of original libheif library. May be it contains these function with another name.

from libheif-rs.

Cykooz avatar Cykooz commented on September 24, 2024

Have you already found a solution how to build the original libheif library (https://github.com/strukturag/libheif) for wasm32-wasi and statically link them to the rust project?
I think this is the most painful task in your case.

from libheif-rs.

Related Issues (20)

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.