Click here to Skip to main content
15,894,180 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hai,


I am getting the error in my .net web application to convert it into tally database.In the rtslink.dll the error is coming.

The error is "Unable to find an entry point named 'Open' in DLL 'RTSLINK.dll'." please clear this.

//Below is the code for that rtslink.dll

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
using System.Runtime.InteropServices;

namespace rtslink
{
    public partial class _Default : System.Web.UI.Page
    {
        [DllImport("RTSLINK.dll",EntryPoint = "Open")]
       public extern static int Open();
        [DllImport("RTSLINK.dll", EntryPoint = "Open")]
       public extern static int Send(string request);

        [DllImport("RTSLINK.dll", EntryPoint = "Open")]
        public extern static string ResponseText();

        [DllImport("RTSLINK.dll", EntryPoint = "Open")]
        public extern static string GetLastErrorMessage();
       

        protected void Button1_Click(object sender, EventArgs e)
        {
            string strResponse = null;
            string strXMLfile = "";
            int n = 0;



            strXMLfile = "<envelope><HEADER><tallyrequest>Import Data</tallyrequest></HEADER><BODY><importdata> <requestdesc><reportname>All Masters</reportname></requestdesc><requestdata><tallymessage xmlns:udf="\"TallyUDF\""> <group name="\"My" mode="hold" />
            n = Open();
            if (n == 0)
            {
                if (Send(strXMLfile) == 0)
                {
                    Response.Write("SUCCESS");

                    strResponse = ResponseText();
                    Response.Write(strResponse);
                }
                else
                {
                    Response.Write("send failed");
                }

            }
            else
            {

                Response.Write(GetLastErrorMessage().ToString());
            }
            
        }
    }
}

</tallymessage></requestdata></importdata></envelope>
Posted

EntryPoint is used to tell the name of the function you want to access in the library. Generally you don't need it. And in your code, all your functions will actually call "Open", which (I am sure) is not what you want.

To check the list of all exported functions from a DLL, you can use Dependency Walker[^]

Use this tool to see what your DLL contains.
 
Share this answer
 
v3
Comments
[no name] 10-May-11 4:20am    
Strange. I would start to ask questions if someone expects me to use a DLL and provides no documentation.
Olivier Levrey 10-May-11 4:34am    
If OP did the dll by himself, the tool can help find that some symbol were not exported as expected.
[no name] 10-May-11 4:40am    
Ok, let's hope so. Calling methods from some random DLL without any documentation can quickly become frustrating.
Olivier Levrey 10-May-11 4:45am    
Frustrating, dangerous, meaningless, and so on ;)
[no name] 10-May-11 4:49am    
And back when I used to write Win32 DLLs, I usually had a preprocessor macro in the header which sorted out that declspec dllimport and declspec dllexport stuff
That's hard. Did you read the error message at all?

Look at the DllImport attributes you specify. In each and every one you specify EntryPoint = "Open" , which can't be right, and the error message says the same.
Simply remove the EntryPoint="Open" Parameters from the attributes and name the methods you declared exactly like the methods in the DLL you want to call.

Edit: According to the MSDN, the EntryPoint parameter names the ordinal number of the method you want to call. Ordinals are numbers like "#1", "#2" or "#123". Forget this if you don't know the ordinal numbers of the methods you want to call.

The EntryPoint parameter also works with the name of the method, but a method "Open" does not seem to exist and also calling "Open" from each of your declarations makes little sense. Find out the names of the methods you want to call and then you can also use them in this parameter.
 
Share this answer
 
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900