2401 : Failed to find the specified function within the DLL

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • el5ateer
    Forum Member
    • Jul 2005
    • 88

    2401 : Failed to find the specified function within the DLL

    Hello Everybody,

    I have searched the forum but didnt find an answer for this question (or maybe i used a wrong search criteria?!)

    Anyway, I created a DLL with Visual Basic Express edition 2005 "thats what the extension says " and i can not use it with AMS as it gives error number 2401 Failed to find the specified function within the DLL .. This might be funny as it's my first time to use Visual basic in any other form than Windows Application ..
    Thats the vb code

    Code:
    Public Class Class1
        Function add(ByVal a, ByVal b, ByVal c)
            Dim total = a + b + c
            Return total
        End Function
    End Class
    and the AMS one

    Code:
    a = Input.GetText("a");
    b = Input.GetText("b");
    c = Input.GetText("c");
    a2 = String.ToNumber(a);
    b2 = String.ToNumber(b);
    c2 = String.ToNumber(c);
    result = DLL.CallFunction("AutoPlay\\Docs\\Add.dll", "add()", ""..a2..","..b2..","..c2, DLL_RETURN_TYPE_INTEGER, DLL_CALL_CDECL);
    Input.SetText("Input4", result);
    this is so simple as i am just trying to create dlls to get experience before college !
    Thanks in advance

    Yours,
    Galal
  • Worm
    Indigo Rose Customer
    • Jul 2002
    • 3971

    #2
    don't use the parenthesis, and chances are it should be DLL_CALL_STDCALL

    Code:
    result = DLL.CallFunction("AutoPlay\\Docs\\Add.dll", "add", ""..a2..","..b2..","..c2, DLL_RETURN_TYPE_INTEGER, DLL_CALL_STDCALL);
    Input.SetText("Input4", result);

    Comment

    • el5ateer
      Forum Member
      • Jul 2005
      • 88

      #3
      Thanks for your reply Worm

      I removed the parenthesis and changed it to DLL_CALL_STDCALL

      But, Unfortunately, didnt work

      i can attach the dll if u want

      Comment

      • Worm
        Indigo Rose Customer
        • Jul 2002
        • 3971

        #4
        go ahead and attach and I'll see what I can do...

        I've not worked with .Net anything, so how do you set you function to be exported?

        Comment

        • el5ateer
          Forum Member
          • Jul 2005
          • 88

          #5
          I don't set anything .. I click Build and it's created along with 2 other files

          I zipped them and they are attached

          (sorry for wasting your time and for any disturbance
          Attached Files

          Comment

          • Worm
            Indigo Rose Customer
            • Jul 2002
            • 3971

            #6
            Well, as best I can tell, there aren't any functions exported for AMS to see. That's the reason it can't find the function. I wish I could be of more help, but I simply haven't used VB to make a DLL before.

            Comment

            • el5ateer
              Forum Member
              • Jul 2005
              • 88

              #7
              then i still have a long way to go didnt expect to be that easy though ..

              Thanks for your help and time Worm

              Comment

              • jfxwave
                Forum Member
                • Mar 2006
                • 145

                #8
                Worm: If you don't mind telling, what do you use to make your dll's?

                Comment

                • Worm
                  Indigo Rose Customer
                  • Jul 2002
                  • 3971

                  #9
                  I don't mind at all.

                  I use both PowerBasic

                  and PureBasic

                  They both have their strengths, but if I was to pick one, it'd have to be PureBasic. It's less expensive, and has a much more active user forum, plus there are a lot of libraries that are free to use. It does have some stipulations on creating DLLs that wrap the internal functions that are proprietary to PureBasic, but so far, that hasn't been an issue for me.

                  Search the forum for PowerBasic or PureBasic. I have a couple posts where I've posted the source to some of the DLLs I've uploaded.

                  Comment

                  • Buffman
                    Indigo Rose Customer
                    • Mar 2005
                    • 187

                    #11
                    Hi el5ateer,

                    DLLs created using VB are COM/ActiveX DLLs, not standard DLLs. In a nutshell, they only work with VB apps. Even C++ programmers have a hard time calling DLLs written in VB; they generally have to initialize the COM library and that doesn't even always work.

                    I haven't found a way to get it working in AMS - not to say that it can't be done, but for the most part just don't work the way standard DLLs do.

                    Hope this helps...

                    Comment

                    • el5ateer
                      Forum Member
                      • Jul 2005
                      • 88

                      #12
                      Thanks Buffman for your help .. I will try to use programs specified in eariler reply in here and namely Purebasic

                      I downloaded the demo .. And will try to find some tutorials and these stuff

                      thanks again,
                      el5ateer

                      Comment

                      • Dermot
                        Indigo Rose Customer
                        • Apr 2004
                        • 1791

                        #13
                        DLLs created using VB are COM/ActiveX DLLs, not standard DLLs. In a nutshell, they only work with VB apps.
                        The dll he posted is not COM but it's not a standard Windows dll. I just want to point out that true COM dlls can be used by any developement tool that supports COM. This includes AMS if you have the free luacom plugin. Not just VB. I use several advanced COM dlls with AMS and they work great. They add a lot of functionality to AMS.

                        The attached project uses the free SQLite3 COM dll from NewObjects.


                        It requires the free luacom plugin from http://www.icynorth.com/luacom/index.html.

                        The SQLite3 COM dll allows you to work with SQLite3 databases in AMS. It is exremely easy to work with, almost easier than the SQLite plugin.

                        I just thought it would Demonstrate how easy it is to use COM dlls with AMS.
                        Last edited by Dermot; 05-09-2007, 11:22 PM.
                        Dermot

                        I am so out of here :yes

                        Comment

                        • Buffman
                          Indigo Rose Customer
                          • Mar 2005
                          • 187

                          #14
                          Awesome!

                          Thanks for the info, Dermot!!

                          Comment

                          Working...
                          X