all groups > dotnet interop > september 2006 >
You're in the

dotnet interop

group:

why is this simple dllimport not working?


why is this simple dllimport not working? troy NO[at]SPAM makaro.com
9/4/2006 2:17:07 PM
dotnet interop: Hi, I'm new to using dllimport. I'm getting the following error:
System.EntryPointNotFoundException.

Here is my code:

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

namespace DialogicTest
{
class Program
{

[DllImport("libsrlmt.dll", EntryPoint = "sr_libinit",
CallingConvention =
CallingConvention.Cdecl)]
static extern int sr_libinit(ushort type);

static void Main(string[] args)
{
ushort test = 1;
try
{
int result = sr_libinit(test);
Console.WriteLine(result);
}
catch (Exception e)
{
Console.WriteLine(e);
}
}
}
}

The srlib.h has sr_libinit defined as:
extern long __cdecl sr_libinit(unsigned short flag);

Did I mess something up or is it perhaps that the method does not
belong to that dll?

Troy
Re: why is this simple dllimport not working? troy NO[at]SPAM makaro.com
9/4/2006 4:26:19 PM
Thanks, I'll try that
Re: why is this simple dllimport not working? Peter Franks
9/4/2006 9:01:35 PM
[quoted text, click to view]

Re: why is this simple dllimport not working? Mattias Sjögren
9/5/2006 12:02:01 AM

[quoted text, click to view]

Maybe, have you tried using a tool like Dumpbin to list its exported
functions?


Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
AddThis Social Bookmark Button