How to access unmanaged DLL from within ASP.NET (using VB.NET)

Discussion in 'ASP .Net' started by Sacha Korell, Jul 25, 2003.

  1. Sacha Korell

    Sacha Korell Guest

    (This is a continuation of my post from earlier today.)

    I have been semi-successful by using the good old DECLARE FUNCTION like
    Declare Function OpenCD Lib "functions.dll" Alias "COpenCD" (ByVal
    DiscNumber As Long, ByVal DiscPath As String) As Long

    However, when I make the call to the function within the DLL I get:

    "Object reference not set to an instance of an object."

    Do I somehow have to instantiate the DLL???


    I have also tried to use the DllImport statement like this:

    <DllImport("functions.dll", EntryPoint:="OpenCD", SetLastError:=True,
    CharSet:=CharSet.Unicode, ExactSpelling:=True,
    CallingConvention:=CallingConvention.StdCall)> _
    Public Shared Function COpenCD(ByVal DiscNumber As Long, ByVal DiscPath As
    String) As Long

    ' Leave function empty - DLLImport attribute forwards calls to OpenCD to

    ' OpenCD in functions.dll.

    End Function

    ....but when I use it, I get:

    "Unable to find an entry point named OpenCD in DLL functions.dll."

    How can I access an unmanaged DLL from within ASP.NET?
    Please help!


    Sacha Korell, Jul 25, 2003
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.