Discussion:
Problems with DLL C#
(too old to reply)
Treephwood1978
2010-01-26 10:38:58 UTC
Permalink
Raw Message
Hi! (my english not is perfect :) )
I have this problems...

In second dll import i have the error message (EntryPointNotFoundedException).
..
Helpe ME!


using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;


namespace Proof
{

class Program
{

internal const string DllName = "rec1.dll";
[DllImport(DllName, EntryPoint = "Init", SetLastError = true)]
internal static extern long Init(string Name, string Key);

[DllImport(DllName, EntryPoint = "LoadImage", SetLastError = true)]
internal static extern long LoadImage(long SesHandle, string File,
long NumPagina);


public static void Main()
{
long Sessione = Init("version", "version");
long DIBHandle;


Console.WriteLine("Sessione: " + Sessione);
DIBHandle = LoadImage(Sessione, "proof.tif", 0);
Console.WriteLine("Valore DIBHandle: " + DIBHandle);

}
}

}
Fábio Chicout
2010-01-26 17:25:05 UTC
Permalink
Raw Message
Hi Treephwood,

The EntryPointNotFoundedException is thrown when the name of the method in
C# is not the same into your native DLL.

Go to the command prompt (the Visual Studio Command Prompt), use the utility
dumpbin /exports <path_to_your_native_dll>
this is gonna show you all the functions exposed by your dll. Then you have
two choices:
1- Change the signature of your C# method to reflect what's exposed
2- Use the parameter EntryPoint on the DllImport Atribute

Maybe the problem can be solved just compiling your native dll adding to the
signature the modifier:
extern "C"

If you have any doubt yet, send some information (code) 'bout your native
dll.

Att,
Fábio Chicout
Post by Treephwood1978
Hi! (my english not is perfect :) )
I have this problems...
In second dll import i have the error message
(EntryPointNotFoundedException).
..
Helpe ME!
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace Proof
{
class Program
{
internal const string DllName = "rec1.dll";
[DllImport(DllName, EntryPoint = "Init", SetLastError = true)]
internal static extern long Init(string Name, string Key);
[DllImport(DllName, EntryPoint = "LoadImage", SetLastError = true)]
internal static extern long LoadImage(long SesHandle, string File,
long NumPagina);
public static void Main()
{
long Sessione = Init("version", "version");
long DIBHandle;
Console.WriteLine("Sessione: " + Sessione);
DIBHandle = LoadImage(Sessione, "proof.tif", 0);
Console.WriteLine("Valore DIBHandle: " + DIBHandle);
}
}
}
Loading...