Announcement

Collapse
No announcement yet.

The application failed to initialize properly

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • The application failed to initialize properly

    Hi All,

    I am a PowerBasic newbie and I have just hit a brick wall. I am trying to create a dll to get and process data from a proprietary driver dll, the Dallas iButton TMEX driver for Windows. The idea is to bring the data into Excel or Access. I have lots of experience with these devices and their drivers using VB, VBA and Delphi.

    I spent yesterday debugging some code and compiling it as an exe which works fine. Fast and compact as advertised. I removed the PBMAIN function and compiled it as a dll. I wrote a little application to call the dll and do some basic functions. It compiles OK but when I go to run it I get the error message "The application failed to initialize properly (c000007b)."

    I can't even debug the application. Does anyone have any clues? Should I post the code and/or the full error details? I am using Vista Business.

    Thanks in Advance,

    Rob

  • #2
    It's a missing import in the DLL - check your declares in the EXE and EXPORTed functions in the DLL. You must use the ALIAS keyword to ensure same-case matching for an EXPORT function in the DLL.

    Here is a useful (and free!) utility which easily shows what you are exporting/importing: http://www.dependencywalker.com/ If you open the EXE using this utility, it'll show any missing imports in red.
    kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

    Comment


    • #3
      I can't even debug the application. Does anyone have any clues? Should I post the code and/or the full error details? I am using Vista Business.
      Before the "Jackyls Pounce" (bad joke)

      I must say welcome and thanx for asking.

      It appears Kev has posted already between my time of reading and posting, and much to credit ideas that totally slipped my mind.

      If Alias does not solve the problem, then the answer to your question is "BOTH" because no one can debug without full error details, and no one can debug if they can not replicate the problem.

      If you think the program in question is "Too Large" to post, then demo the problem with a fully compilable demo to show the same (side note you will be AMAZED how often you find a mistake in code trying to demo a problem)

      When posting, try to use [ C O D E ] InsertCode [/ C O D E ] wrappers (take out the spaces)

      Also if you find an answer from your own research, or assistance of others, please post what you did so that years down the line someone in the same situation can learn from mistakes of the past.

      (oh by the way I bet $2 that Kev's answer is right )
      Engineer's Motto: If it aint broke take it apart and fix it

      "If at 1st you don't succeed... call it version 1.0"

      "Half of Programming is coding"....."The other 90% is DEBUGGING"

      "Document my code????" .... "WHYYY??? do you think they call it CODE? "

      Comment


      • #4
        Hi Kev and Cliff,

        I really like the dependancy walker. Thanks for the tip. I don't mind posting these bits of code if you don't mind looking at them. They are things derived from the manufacturer's SDK.

        It turns out that I had made numerous mistakes. Now I have hit another snag. I can now step into the TestOW.bas code which is a great improvement. However, as soon as I hit the DeviceCount function it fails and throws the message

        Exception: Memory Access Violation
        Program tried to read or write an invalid memory address

        Do you have any clues about this one?

        (later) Found the problem! I just didn't sprinkle BYVAL around liberally enough. I am now back on track heading for the next brick wall.


        Thanks again,

        Rob
        Attached Files
        Last edited by Robert Keith; 17 Feb 2009, 11:11 PM. Reason: Resolved the problem myself.

        Comment


        • #5
          The declare in the exe has byval and not in the dll.

          Function GetUID Alias "GetUID" (UIDno As Integer) Export As String
          If no value is returned via UIDno i suggest you make this byval as well or change the exe's declare to byref.
          hellobasic

          Comment


          • #6
            Thanks for the help

            Thanks for the help with these problems. We are now up and running. This morning we were able to access the dll with Excel and LabView and discuss fine-tuning the functionality, all this after less than three days with PowerBasic.

            Regards,

            Rob

            Comment

            Working...
            X