How to structure and step through a project using vb.net and vc++.net
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9

Thread: How to structure and step through a project using vb.net and vc++.net

  1. #1
    Join Date
    Aug 2010
    Posts
    46

    Smile How to structure and step through a project using vb.net and vc++.net

    Firstly, this post may be in the wrong place - if so, I am sorry and doubtless somebody will move it!

    I have a large (to me) project created in VB6 with a DLL which I wrote in VC++ 6.0. It all works fine and has been released (as freeware) for some time.

    I initially updated it to vb.net Express 2010 and VC++.net Express 2010 and it sort of works OK but had problems debugging ....

    So, now I have a new laptop running Win 8.1 and have installed Visual Basic Express 2013. So, I click on "myproject.vbproj" and it starts up fine and I can walk through the vb.net code using F11 etc. No problem

    Now I want to start amending the vc++.net dll that I wrote (it is in native code for speed and also includes some asm for bit handling - because I can do stuff in asm that I would not even know where to start on with C). Let me repeat that, the asm is there for very complicated (to me anyway) bit handling. I say that to stop the lectures on not using asm because it is no quicker because the compiler has to do stuff with registers every time you call an asm routine ...

    So, my question "How do I structure this so I can walk, using F11 etc, seemlessly through the vb.net code and the vc++ code?"

    Please don't tell me to do it all in vb.net because that will add on many months to the conversion process ...

    Many thanks people!
    MOPEKS - a freeware program that generates programs that use each other to solve problems

  2. #2
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    4,100

    Re: How to structure and step through a project using vb.net and vc++.net

    afaik,
    what you ask won't work with the VS2010 express version, since the express version doesn't allow mixed mode debugging.

    it "might" work with the 2012 express, but I'm not entirely sure they enabled it there (there was mention about supporting mixed mode in 2012 express).


    so for 2010 express
    ALL of your code needs to be native, or ALL of it needs to be managed.
    you can only debug whatever mode the executable/process starts in.


    Edit:
    if your version of VS express supports mixed mode, then in the project options, under debug there should be a checkbox for "Enable unmanaged code debugging".
    Last edited by OReubens; September 4th, 2014 at 09:13 AM.

  3. #3
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,594

    Re: How to structure and step through a project using vb.net and vc++.net

    Quote Originally Posted by OReubens View Post
    what you ask won't work with the VS2010 express version, since the express version doesn't allow mixed mode debugging.
    AFAICT you're right, but to me the issue here seems to be mixed language debugging rather than mixed mode. While, in fact, that isn't supported by the Express versions either, I have a potential approach to suggest to circumvent that restriction. (Can't test that, though, since I don't have VB .NET installed.)

    So, OP: You may try to start your application outside of both VS Express IDEs, then attach the debugger of VC++ to the running process. Then try so set break points in your C++ code and see whether they get hit when you have your app call the respective routines. That way you wouldn't be able to debug both your VB and C++ code in the same session, but at least you could debug both.

    A rather daredevil-style variation of the above approach would be to start your app inside the VB .NET debugger, then try to attach the C++ deugger to the running debuggee process. I wouldn't really consider chances for that to work high, but I think at least there is a small chance, so it may be worth a try. If that works, it would allow you to debug your VB and C++ code parts in the same session, yet not in the same debugger.

    HTH
    Last edited by Eri523; September 4th, 2014 at 05:47 PM.
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

  4. #4
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    4,100

    Re: How to structure and step through a project using vb.net and vc++.net

    Quote Originally Posted by Eri523 View Post
    So, OP: You may try to start your application outside of both VS Express IDEs, then attach the debugger of VC++ to the running process.
    that relies on "just in time" debugging features, which the express version doesn't do.
    more downlevel, that's essentially also the underlying reason why mixed mode debugging doesn't work.

  5. #5
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,594

    Re: How to structure and step through a project using vb.net and vc++.net

    Quote Originally Posted by OReubens View Post
    that relies on "just in time" debugging features, which the express version doesn't do.
    more downlevel, that's essentially also the underlying reason why mixed mode debugging doesn't work.
    I'm not exactly sure about actual JIT debugging, but attaching to a running process works with the Express, it's just that the respective menu item remains invisible until advanced features are enabled.
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

  6. #6
    Join Date
    Aug 2010
    Posts
    46

    Re: How to structure and step through a project using vb.net and vc++.net

    Quote Originally Posted by OReubens View Post
    afaik,
    what you ask won't work with the VS2010 express version, since the express version doesn't allow mixed mode debugging.

    it "might" work with the 2012 express, but I'm not entirely sure they enabled it there (there was mention about supporting mixed mode in 2012 express). native, or ALL of it needs to be managed.
    you can only debug whatever mode the executable/process starts in.
    Many thanks but I said "So, now I have a new laptop running Win 8.1 and have installed Visual Basic Express 2013".

    I know it does not work with 2010 - that is why I installed 2013
    MOPEKS - a freeware program that generates programs that use each other to solve problems

  7. #7
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,477

    Re: How to structure and step through a project using vb.net and vc++.net

    Wavering, by the sounds of some of your posts it seems like you've been programming a long time. Given that I'm a bit surprised that you haven't purchased a full version of VS. Maybe you're just waiting for VS 2014?
    Last edited by Arjay; September 6th, 2014 at 10:38 AM.

  8. #8
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    4,100

    Re: How to structure and step through a project using vb.net and vc++.net

    see the 'edit' in #2. that'll tell you if it's supported.

  9. #9
    Join Date
    Aug 2010
    Posts
    46

    Re: How to structure and step through a project using vb.net and vc++.net

    Quote Originally Posted by Arjay View Post
    Wavering, by the sounds of some of your posts it seems like you've been programming a long time. Given that I'm a bit surprised that you haven't purchased a full version of VS. Maybe you're just waiting for VS 2014?
    Well, I have been programming for many decades but that does not make me a good programmer - just old and slow!

    I think I need to rephrase my question to read as follows:

    "I had vb.net express 2010 and vc++ express 2010 installed on an XP laptop and it all worked but I was unable to step through my Native Code DLLs to debug them

    Now, I have moved to a new win 8.1 laptop and have installed Visual Studio 2013 but cannot call the DLLs as am getting incorrect format errors (probably 32 bit v 64 bit problem). I also note that in trying to create a new DLL in VS2013 there is no provision for Native Code that I can see

    So, should I uninstall VS2013 and install vb.net Express 2010 and VC++ Express 2010 (or 2012? Or VS Professional) or what?!"

    All help appreciated - I am drowning!
    Last edited by wavering; September 7th, 2014 at 09:50 AM.
    MOPEKS - a freeware program that generates programs that use each other to solve problems

Tags for this Thread

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center