estoy tratando de utilizar pHash de .NETEl uso de .NET pHash
primero que intenté fue registrar (regsvr32) phash.dll
y preguntó here En segundo lugar, yo estaba tratando de importar usando DllImport como se muestra a continuación .
[DllImport(@".\Com\pHash.dll")]
public static extern int ph_dct_imagehash(
[MarshalAs(UnmanagedType.LPStr)] string file,
UInt64 hash);
Pero cuando intento acceder al método anterior durante el tiempo de ejecución, aparece el siguiente mensaje de error.
Unable to find an entry point named 'ph_dct_imagehash' in DLL '.\Com\pHash.dll'.
¿Qué significa "punto de entrada" y por qué estoy consiguiendo el error?
Gracias.
FYI - Aquí está el código fuente completo
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Windows;
namespace DetectSimilarImages
{
public partial class MainWindow : Window
{
[DllImport(@".\Com\pHash.dll")]
public static extern int ph_dct_imagehash(
[MarshalAs(UnmanagedType.LPStr)] string file,
UInt64 hash);
public MainWindow()
{
InitializeComponent();
Loaded += MainWindow_Loaded;
}
void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
try
{
UInt64 hash1 = 0, hash2 = 0;
string firstImage = @"C:\Users\dance2die\Pictures\2011-01-23\177.JPG";
string secondImage = @"C:\Users\dance2die\Pictures\2011-01-23\176.JPG";
ph_dct_imagehash(firstImage, hash1);
ph_dct_imagehash(secondImage, hash2);
Debug.WriteLine(hash1);
Debug.WriteLine(hash2);
}
catch (Exception ex)
{
}
}
}
}
Quizás quiso compilar el DLL mismo? De ser así, ¿se ocupó de exportar adecuadamente la función relevante? –
@konrad: compilé la fuente yo mismo pero estoy perdido de lo que dijiste sobre "exportar adecuadamente las funciones relevantes" porque no estoy familiarizado con C++ en absoluto ... – Sung
@Sung Entonces la solución es fácil: * no lo hagas * compila la biblioteca tú mismo. Use el binario precompilado. –