dcsimg
Results 1 to 11 of 11

Thread: VB.net project with VC++ project dll stopped working when moved from XP to Windows 7

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2012
    Location
    Wiltshire, England
    Posts
    211

    Question VB.net project with VC++ project dll stopped working when moved from XP to Windows 7

    Hi All,

    All was working fine on XP, but gives this error on Windows 7 (64 bit):

    "An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)"

    I've googled the message and it points to a 32/64 bit mismatch problem.

    the VB.Net project has (under Project Properties, then "Advanced Compile Options") has a Target CPU of AnyCPU.

    You don't get this screen under properties for the C++ dll.

    In "Configuration Manager" my VB.Net project has a platform of "Any CPU" and my C++ library has a Platform of "Win32" - I was hoping to change my platform to "Any CPU", but that option wasn't there, only "New..." and "Edit..."
    If I do "New..." I can add a platform of "x64", but when I rebuild it I get a load of link errors (LNK2001).

    Ideally I want my solution to run on XP and Windows 7 (64 bit and 32 bit) without having to compile different versions for different platforms.

    Many Thanks

    Kristian

  2. #2
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,242

    Re: VB.net project with VC++ project dll stopped working when moved from XP to Window

    So compile all for x86 (32 bit) (Framework 4 or earlier) to give yourself a chance!
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 2012
    Location
    Wiltshire, England
    Posts
    211

    Re: VB.net project with VC++ project dll stopped working when moved from XP to Window

    Hi,

    I can set the Target CPU to "x86" for the VB project, but you don't get that screen for the C++ project.

    In the C++ library Properties page under linker, ther is a "MachineX86" option I can set for the "Target Machine" - Is that what you meant?

    Thanks

    Kristian

  4. #4
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,242

    Re: VB.net project with VC++ project dll stopped working when moved from XP to Window

    Yup!
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jul 2012
    Location
    Wiltshire, England
    Posts
    211

    Re: VB.net project with VC++ project dll stopped working when moved from XP to Window

    Hi,

    Changed the linker setting, but same problem.

    Kris

  6. #6
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,242

    Re: VB.net project with VC++ project dll stopped working when moved from XP to Window

    OK. So what framework are you compiling to, and what frameworks are present on the two machines? Is this C++ library one you created yourself, downloaded from somewhere, part of a third party program?
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Jul 2012
    Location
    Wiltshire, England
    Posts
    211

    Re: VB.net project with VC++ project dll stopped working when moved from XP to Window

    OK,

    Windows 7 machine has MS .NET Framework 4 Client Profile, Extended and Multi-Targeting Pack installed.
    On XP it has MS .NET Compact Framework 2.0 SP2, MS .NET Compact Framework 3.5, MS .NET Framework 1.1, MS .NET Framework 2.0 SP2, MS .NET Framework 3.0 SP2, MS .NET Framework 3.5 SP1 & MS .NET Framework 4 Client Profile, Extended and Multi-Targeting Pack installed.


    on Windows 7(SP1) and XP(SP3), The VB project is set to use the MS .NET Framework 4 as its target framework and the C++ library doesn't seem to have that setting, but is using the v100 Platform Toolset (if that matters).

    The C++ Library was written in house, but the guy is now on holiday.

    Is it normal to have different platforms listed under each project in Configuration Manager? My VB project only has "Any CPU" as an option and the C++ library has Win32 & x64

    This is the 1st time I've had to code anything for Windows 7 as I've worked exclusively with XP and only a few years ago stopped supporting NT4.

    Thanks for your time

    Kristian

  8. #8
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,242

    Re: VB.net project with VC++ project dll stopped working when moved from XP to Window

    C++ doesn't have any target framework because it isn't .Net. It's essentially platform independent. You probably do need to know whether the library was intended for 32bit or 64bit though.

    Configuration Manager won't give you any options because that's not really its job. If you want to change Framework & CPU settings for the project, you need ...

    Properties (right click on the Project name in Solution Explorer or select from the Project Menu) > Compile > Advanced Compile Options

    ... for a comprehensive choice of, well, options!
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Jul 2012
    Location
    Wiltshire, England
    Posts
    211

    Re: VB.net project with VC++ project dll stopped working when moved from XP to Window

    Sorry for the delay in replying - got diverted onto someone else's C# problem, not that I know anything about C#!
    I'll have another look through those options.

    Thanks

    Kristian

  10. #10
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    22,962

    Re: VB.net project with VC++ project dll stopped working when moved from XP to Window

    VC++ dlls are 32 bit by default

  11. #11

    Thread Starter
    Addicted Member
    Join Date
    Jul 2012
    Location
    Wiltshire, England
    Posts
    211

    Re: VB.net project with VC++ project dll stopped working when moved from XP to Window

    Hi Paul,

    The C++ library's active platform is set to Win32.
    If I work out what it is I'll update the thread.

    Thanks

    Kristian

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width