locked
Strange Error - Please Help RRS feed

  • Question

  • Hi all,

    I wrote a dll (using a definition file). When I call one of the function within the dll from another application (to test the function), I receive a strange error (Messagebox format): Application.exe - Ordinal Not Found - The ordinal 34 could not be located in the dynamic link library. Note I have linked with the .lib file, have included the header file and copied the .dll file to the application directory. (Note that I'm exporting 34 functions)

    Can anyone help??

    Thanx
    Monday, October 16, 2006 7:56 AM

Answers

  • Start the VS2005 command prompt and navigate to your application directory. From there, do a "dumpbin /exports thedllfile.dll". Verify that the ordinals and function names are as intended.
    Monday, October 16, 2006 9:04 AM
  • Ok, that looks better. You are certain this is the dll your application attempts to open? Try moving the dll into the debug (or release) directory, and launch it from there.
    Monday, October 16, 2006 9:36 AM

All replies

  • Have you properly exported the functions?

    Or are you trying to export using Ordinals from DLL?

    Please see the documentation from MSDN

    Exporting Functions from a DLL by Ordinal Rather Than by Name

    Monday, October 16, 2006 8:24 AM
  • Sarath, thanx for the reply.

    Yes, according to me I have exported the functions correctly. The thing is all the functions work, except the last three. The names of the last three functions for example is:

    function_1

    function_2

    function_3

    In def file for example:

    function_1      @1

    function_2      @2

    function_3      @3

    So I am still blown away .... have no idea what could be wrong.

    A dll hasn't got like a limit of functions it can export right?

     

    Monday, October 16, 2006 8:36 AM
  • I don't think that there's a limitation for the number of exported functions in a DLL file and error in the small number of exports.
    Check what differs from other functions.
    Monday, October 16, 2006 8:58 AM
  • Start the VS2005 command prompt and navigate to your application directory. From there, do a "dumpbin /exports thedllfile.dll". Verify that the ordinals and function names are as intended.
    Monday, October 16, 2006 9:04 AM
  • Well, I thought about the same thing.

    And I checked the .def file .h file and .cpp file, and everything looks the same and correct. Do you know of any VC++ 6 bug, that might cause this problem, otherwise thank you for your trouble.

    Monday, October 16, 2006 9:07 AM
  • I receive this error:

    DUMPBIN : fatal error LNK1181: cannot open input file 'thedllfile.dll'

    The 'thedllfile.dll' was just a example I took from what you said, I did not use it in the VS2005 command prompt, I used the right file name.

    Monday, October 16, 2006 9:13 AM
  • Are you absolutely sure the dll can be found in the directory you attempted to open it from?
    Monday, October 16, 2006 9:21 AM
  • Oops ... my bad, The functions in bold are the ones that are giving the error......

    File Type: DLL

      Section contains the following exports for ElkoUtility32.dll

        00000000 characteristics
        45334FDA time date stamp Mon Oct 16 11:24:42 2006
            0.00 version
               1 ordinal base
              34 number of functions
              34 number of names

        ordinal hint RVA      name

             14    0 00001740 CharacterAt
              1    1 00001000 DllMain
             15    2 00001750 authentication
             32    3 00002920 changeIcon
             16    4 00001950 controlPanelDlg
             34    5 00002AD0 createAProcess
              8    6 000013F0 createDSN
             28    7 00002020 createMTPipeSrv
             29    8 000021F0 createOLPipeSrv
             22    9 00001C80 decryptAFile
             21    A 00001C60 encryptAFile
             33    B 00002A40 errorExit
              5    C 00001210 error_out
             12    D 00001590 fileHandler
             20    E 00001C40 getWindowProcessId
             25    F 00001D90 makeSlot
             23   10 00001CA0 messageBeeper
             24   11 00001D30 netValidate
             27   12 00001E80 readSlot
             30   13 000026A0 regEntry
             31   14 00002860 regStartUp
             18   15 00001B00 restartWindows
             11   16 00001530 restoreWnd
             10   17 00001430 seekProgram
              9   18 00001410 showProgramVersion
             19   19 00001B80 shutdown
              2   1A 00001050 sqlconn
              4   1B 000011D0 sqldisconn
              7   1C 00001010 sqldsn
              3   1D 000010E0 sqlexec
              6   1E 00001290 sqltest
             13   1F 000015F0 userNameSize
             17   20 00001A00 validUserName
             26   21 00001DE0 writeSlot

      Summary

           8D000 .data
            2000 .rdata
            2000 .reloc
            1000 .rsrc
            A000 .text

    Monday, October 16, 2006 9:31 AM
  • Ok, that looks better. You are certain this is the dll your application attempts to open? Try moving the dll into the debug (or release) directory, and launch it from there.
    Monday, October 16, 2006 9:36 AM
  • Ok, I''l try that. I'll give a shout then it works.
    Monday, October 16, 2006 9:48 AM
  • Thank you very much ... it is working
    Monday, October 16, 2006 9:52 AM