Results 1 to 8 of 8

Thread: [RESOLVED] VB6 DLL "Unable to find an entry point named" Error

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2010
    Posts
    8

    Resolved [RESOLVED] VB6 DLL "Unable to find an entry point named" Error

    I'm having trouble getting a VB6 dll working in C#. I believe that I have everything setup in the C# program correctly because it doesn't complain until I try to call a function from my VB6 ActiveX dll. When it tries to call the function, I get the following error:

    Unable to find an entry point named 'startImport' in DLL 'ImportActiveX.dll'

    I tried a bunch of things and nothing has worked so far. I believe that there is something wrong with my dll because I checked it with Dependency Walker and none of the functions show up. Here is the code from the class interface:

    Code:
    Option Explicit
    
    Public Event Finished(message As String)
    
    Public Function startImport(inSiteName As String, inDriver As String, inServer As String, inUserID As String, inPassword As String, inDatabase As String) As String
    
        'Declarations
        'Valid input checks
        'Call private functions if input is good
    
        RaiseEvent Finished(g_sImportError)
    
        startImport = g_sImportError
        
    End Function
    g_sImportError is declared in a module.

    I'm probably missing something obvious or basic so please don't leave those out. If any more information is needed, I'll be glad to provide it. Thanks in advance for any help provided.

  2. #2
    Randalf the Red honeybee's Avatar
    Join Date
    Jun 2000
    Location
    off others' brains
    Posts
    4,345

    Re: VB6 DLL "Unable to find an entry point named" Error

    The error seems to indicate that the dll is not a COM dll. Or it does not have a public function named startImport??

    .
    I am not a complete idiot. Some parts are still missing.
    Check out the rtf-help tutorial
    General VB Faq Thread
    Change is the only constant thing. I have not changed my signature in a long while and now it has started to stink!
    Get more power for your floppy disks. ; View honeybee's Elite Club:
    Use meaningfull thread titles. And add "[Resolved]" in the thread title when you have got a satisfactory response.
    And if that response was mine, please think about giving me a rep. I like to collect them!

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2010
    Posts
    8

    Re: VB6 DLL "Unable to find an entry point named" Error

    It works just fine with my VB6 testbed program but that doesn't mean it will work in C#.

    The public function is there but I may not have it setup properly as a COM dll. This is probably a dumb question but I'm fairly new to VB6 (not by choice, long story) and I have to ask: How do I make sure that it is configured to be a COM dll? I'll do some research on my own in the mean time and post if I make any progress.

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: VB6 DLL "Unable to find an entry point named" Error

    OK... so the code above is in your VB6 COM dll? Right? The problem may be your C# code... what does that look like?

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5

    Thread Starter
    New Member
    Join Date
    Nov 2010
    Posts
    8

    Re: VB6 DLL "Unable to find an entry point named" Error

    Here is the C# class implementing it:

    Code:
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Runtime.InteropServices;
    using ImportActiveX;
    
    
    namespace Analyst
    {
        class ImportTool
        {
            [DllImport("ImportActiveX.dll")]
            public static extern string startImport(string inSiteName, string inDriver, string inServer, string inUserID, string inPassword, string inDatabase);
    
            public string beginImport(string inSiteName, string inDriver, string inServer, string inUserID, string inPassword, string inDBName)
            {
                string retString;
    
                retString = startImport(inSiteName, inDriver, inServer, inUserID, inPassword, inDBName);
    
                return retString;
            }
    
        }
    }
    And here is the class declaration:

    Code:
    ImportTool myImporter = new ImportTool();
    
    importerStatus = myImporter.beginImport("Test Site", "{SQL Database}", "localtest", "Test", "Test", "TestDB");
    The code could use some cleaning up. I'm also not too familiar with C# so I may have missed something. I added the reference to the dll to the project and the dll is registered. Everything seems to work fine until I get to the retString = startImport() line. That's when I get the aforementioned error. I don't have a using Analyst; declaration in the project setting up the ImportTool object. Could that have something to do with it?
    Last edited by dspinner; Jan 20th, 2011 at 10:50 AM. Reason: Clarification

  6. #6
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: VB6 DLL "Unable to find an entry point named" Error

    Right... that's what I suspected. the DLLImport tag is for using standard c-style unmanaged DLLs... what you're trying to access is an unmanaged ActiveX DLL ... create the reference... which should add some kind of interop wrapper around it (it'll end up looking something like "AxMyActiveXControl" or something like that, either way, it'll be preceded with "ax" ... then it's just creating an instance of the class and using it like you would any other object.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  7. #7

    Thread Starter
    New Member
    Join Date
    Nov 2010
    Posts
    8

    Re: VB6 DLL "Unable to find an entry point named" Error

    I get a file called Interop.ImportActiveX.dll after I add the reference. I'm using Visual Studio 2010. Is that the same thing? I will give that a try and will post if it works.

    EDIT: That took care of it. It works just fine now. Thanks again for your help!
    Last edited by dspinner; Jan 21st, 2011 at 05:21 PM. Reason: Problem resolved.

  8. #8
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: VB6 DLL "Unable to find an entry point named" Error

    yes... NET adds an interop wrapper that acts as a gateway between the managed .NET code and the unmanaged ActiveX component. So that's expected.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width