none
What could cause code compiled for CE not run correctly, but when compiled for XP does. RRS feed

  • Question

  • Some more information.

    I was tasked to convert a program we have to run on a CE device (We created the CE image for the device, that all works fine). I also had to convert a 3rd party .dll and .exe that our program used.

    After many errors I was able to compile my program, the 3rd party .dll, and the 3rd party .exe. I compiled it with platform builder and the 3rd party .dll and .exe are subprojects of my CE Image.

     

    When I go to run my program on the CE device it runs without crashing or anything, but it should be getting data from a USBdevice ( why the 3rd party .dll and .exe needed) and displaying it. It does not though. I tried creating new projects in VS with the modified code so it compiles for CE for the program, .dll and the .exe and compile it for windows XP (win32). I ran the my program and everything works fine still, although it is a bit slower than the original.

     

    So, are there any reasons why code that was designed for CE does not run correctly on CE, but does when compiled for XP?

     

    Thanks for any suggestions,

    Rob


    Monday, April 18, 2011 3:54 PM

Answers

  • Michel used sarcasm, but his response is very serious.

    There is no magic tool to port from one OS to another.  The good news is that the code for XP and CE are quite often very similar, the bad news is that XP and CE are quite often so similar that it is easy to miss subtle differences, like the ones that I cited above.


    Bruce Eitman (eMVP)
    Senior Engineer
    Bruce.Eitman AT Eurotech DOT com
    My BLOG http://geekswithblogs.net/bruceeitman

    Eurotech Inc.
    www.Eurotech.com
    • Marked as answer by Rob Filippi Wednesday, April 20, 2011 12:24 PM
    Tuesday, April 19, 2011 4:23 PM
    Moderator

All replies

  • Rob:

    Getting the code to compile, and getting it to run are two very different things.  For example:

    CreateFile( "C:\\Something\\File.txt", ... );

    Might compile, but since Windows CE doesn't have drive letters, the call would fail (not to mention that Windows CE uses Unicode).  Similarly:

    CreateFile( TEXT("File.txt", ... );

    Would compile for both, but on Windows XP the file would be in the current working folder.  But CE doesn't have a concept of current working folder, so the file would be in the root of the file system.

    These are just a couple of example of why your code may not work correctly on a Windows CE device.


    Bruce Eitman (eMVP)
    Senior Engineer
    Bruce.Eitman AT Eurotech DOT com
    My BLOG http://geekswithblogs.net/bruceeitman

    Eurotech Inc.
    www.Eurotech.com
    Monday, April 18, 2011 4:38 PM
    Moderator
  • Bruce,

    What do you think I should do then for this. What way would you suggest I go about getting my program, the 3rd party .dll, and .exe to work?

     

    I had mention Windows XP embedded to my supervisor, but he said we need to be using a real-time OS. I believe Windows XPe can be modified to be real-time with some 3rd party modifications...?

     

    If you suggest sticking with CE though, how do you suggest that I get these to work. I am not sure what would run on XP vs CE (code wise). I was just trying to make them compile without errors.

    *edit*

    I can post the code for the .dll and .exe as they are free to download from the provider, but they are hundreds of lines of code. Just let me know

    Monday, April 18, 2011 4:46 PM
  • Is it possible for you to figure out what lines of code work properly and don't work properly?  There must be a way where you can post a segment of code and say, "it works up to here and not after" and then we can all see what line(s) (hopefully no more than 5-10) don't work properly.  You may have something like Bruce pointed out.

     

    I don't think posting hundreds of lines on here will get you any help though.  If you narrow it down to a small number of lines and can identify for us which work and which don't, then you have a much better chance of getting an answer.

    Monday, April 18, 2011 8:44 PM
  • There's this amazing thing they invented recently... it's called
    step-debugging! ;)
     

    Good luck,

    Michel Verhagen, eMVP
    Check out my blog: http://guruce.com/blog

    GuruCE
    Microsoft Embedded Partner
    http://guruce.com
    Consultancy, training and development services.
    Tuesday, April 19, 2011 1:53 AM
    Moderator
  • Michel used sarcasm, but his response is very serious.

    There is no magic tool to port from one OS to another.  The good news is that the code for XP and CE are quite often very similar, the bad news is that XP and CE are quite often so similar that it is easy to miss subtle differences, like the ones that I cited above.


    Bruce Eitman (eMVP)
    Senior Engineer
    Bruce.Eitman AT Eurotech DOT com
    My BLOG http://geekswithblogs.net/bruceeitman

    Eurotech Inc.
    www.Eurotech.com
    • Marked as answer by Rob Filippi Wednesday, April 20, 2011 12:24 PM
    Tuesday, April 19, 2011 4:23 PM
    Moderator
  • I will look into step-debugging more. VS2005 debugger confuses me, but I will look into more info on it. Also, any general guidelines you can point out to look for? This is my first time work with CE and my coding experience in C is a lot smaller than say java.

     

     

    Thanks

    Rob

    Wednesday, April 20, 2011 12:30 PM