Coder Social home page Coder Social logo

Comments (2)

DiracSpace avatar DiracSpace commented on August 31, 2024

The previous question works but I'm getting this issue and can't seem to pinpoint the problem.
Message: "Unable to find an entry point named 'CopyMemory' in DLL 'kernel32.dll'.\r\nIn WebP.AdvancedEncode"

It seems to arrive to this part of the code in the wrapper:

// not working
//compress the input samples
if (UnsafeNativeMethods.WebPEncode(ref config, ref wpic) != 1)
    throw new Exception("Encoding error: " + ((WebPEncodingError)wpic.error_code).ToString());

That jumps to this code here and it breaks upon entering WebPEncode_x64

/// <summary>Compress to WebP format</summary>
/// <param name="config">The configuration structure for compression parameters</param>
/// <param name="picture">'picture' hold the source samples in both YUV(A) or ARGB input</param>
/// <returns>Returns 0 in case of error, 1 otherwise. In case of error, picture->error_code is updated accordingly.</returns>
internal static int WebPEncode(ref WebPConfig config, ref WebPPicture picture)
{
    switch (IntPtr.Size)
    {
        case 4:
            return WebPEncode_x86(ref config, ref picture);
        case 8:
            return WebPEncode_x64(ref config, ref picture);
        default:
            throw new InvalidOperationException("Invalid platform. Can not find proper function");
    }
}
[DllImport("libwebp_x86.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "WebPEncode")]
private static extern int WebPEncode_x86(ref WebPConfig config, ref WebPPicture picture);
[DllImport("libwebp_x64.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "WebPEncode")]

from webp-wrapper.

DiracSpace avatar DiracSpace commented on August 31, 2024

The solution is to change:

[DllImport("kernel32.dll", EntryPoint = "CopyMemory", SetLastError = false)]

You should end up with:

[DllImport("kernel32.dll", EntryPoint = "RtlMoveMemory", SetLastError = false, ExactSpelling = true)]
internal static extern void CopyMemory(IntPtr dest, IntPtr src, uint count);

from webp-wrapper.

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.