Skip to content
This repository was archived by the owner on Nov 19, 2020. It is now read-only.
This repository was archived by the owner on Nov 19, 2020. It is now read-only.

DllNotFoundException: ntdll on OS X #162

@haf

Description

@haf

I'm trying to get started with Accord, but it doesn't seem to want to read my image:

System.DllNotFoundException: ntdll.dll
  at (wrapper managed-to-native) AForge.SystemTools:memset (byte*,int,int)
  at AForge.SystemTools.SetUnmanagedMemory (System.Byte* dst, Int32 filler, Int32 count) [0x00000] in <filename unknown>:0
  at AForge.SystemTools.SetUnmanagedMemory (IntPtr dst, Int32 filler, Int32 count) [0x00000] in <filename unknown>:0
  at AForge.Imaging.UnmanagedImage.Create (Int32 width, Int32 height, PixelFormat pixelFormat) [0x00000] in <filename unknown>:0
  at AForge.Imaging.Filters.BaseUsingCopyPartialFilter.Apply (AForge.Imaging.UnmanagedImage image) [0x00000] in <filename unknown>:0
  at Accord.Imaging.Filters.WolfJolionThreshold.ProcessFilter (AForge.Imaging.UnmanagedImage sourceData, AForge.Imaging.UnmanagedImage destinationData) [0x00000] in <filename unknown>:0
  at AForge.Imaging.Filters.BaseFilter.Apply (System.Drawing.Imaging.BitmapData imageData) [0x00000] in <filename unknown>:0
  at AForge.Imaging.Filters.BaseFilter.Apply (System.Drawing.Bitmap image) [0x00000] in <filename unknown>:0
  at <StartupCode$FSI_0001>.$FSI_0001.main@ () [0x00000] in <filename unknown>:0
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0

With this code:

  let image : Bitmap = Bitmap.FromFile args.[0] :?> Bitmap
  let wolfJoulion = Accord.Imaging.Filters.WolfJolionThreshold()
  let result : Bitmap = wolfJoulion.Apply(image)
  result.Save args.[1]

It seems that UnmanagedImage needs ntdll which obviously isn't available on OS X.

Going directly against UnmanagedImage:

System.DllNotFoundException: ntdll.dll
  at (wrapper managed-to-native) AForge.SystemTools:memset (byte*,int,int)
  at AForge.SystemTools.SetUnmanagedMemory (System.Byte* dst, Int32 filler, Int32 count) [0x00000] in <filename unknown>:0
  at AForge.SystemTools.SetUnmanagedMemory (IntPtr dst, Int32 filler, Int32 count) [0x00000] in <filename unknown>:0
  at AForge.Imaging.UnmanagedImage.Create (Int32 width, Int32 height, PixelFormat pixelFormat) [0x00000] in <filename unknown>:0
  at AForge.Imaging.Filters.BaseFilter.Apply (AForge.Imaging.UnmanagedImage image) [0x00000] in <filename unknown>:0
  at <StartupCode$FSI_0001>.$FSI_0001.main@ () [0x00000] in <filename unknown>:0
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0

Code in question:

        public static unsafe byte* SetUnmanagedMemory(byte* dst, int filler, int count)
        {
            return memset(dst, filler, count);
        }


        // Win32 memory copy function
        [DllImport("ntdll.dll", CallingConvention = CallingConvention.Cdecl)]
        private static unsafe extern byte* memcpy(byte* dst, byte* src, int count);

        // Win32 memory set function
        [DllImport("ntdll.dll", CallingConvention = CallingConvention.Cdecl)]
        private static unsafe extern byte* memset(byte* dst, int filler, int count);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions