Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
  • Welcome
  • Products
  • Support
  • About
  • More
  • Cancel
MicroStation
  • Product Communities
  • More
MicroStation
MicroStation Wiki Debugging Native Code MDL Applications
    • Sign in

    • +MicroStation Wiki
    • +Administration Wiki
    • +Annotations Wiki
    • +Bentley View Wiki
    • +MicroStation PowerDraft
    • -Programming Wiki
      • A class to help create and modify text element
      • A Complete Example
      • A MicroStation VBA Example With Bentley ProjectWise
      • AddIn Development Using VB.NET
      • C# .NET Template with IPrimitiveCommandEvents Class
      • Capturing Graphics in Dynamic Views
      • Compiling MDL Applications
      • Database Manipulation
      • Debugging Native Code MDL Applications
      • Developing Code in VBA
      • Developing MicroStation Applications For DWG Files
      • Drag and Drop in MicroStation
      • Error: "Cannot save changes to VBA project 'Support' because it is read-only"
      • Getting And Setting Elements Using Graphic Groups In VBA [CS]
      • Getting Started with Visual Basic
      • How To Write A Recursive Routine In MicroStation VBA [CS]
      • Introducing Segment3D Methods In MicroStation V8 2004 Edition
      • Known issues in MDL and MicroStationAPI
      • Launching VBA Applications As Initapps Or Dgnapps [CS]
      • Learning MicroStation Addins Step by Step
      • MDL - Getting Started With XAttributes In MicroStation V8 XM Edition
      • MDL - Native Code Application Development
      • MDL Or MicroStation BASIC Choosing The Right Tool [TN]
      • MFC Dialog And Native Window Support
      • Microsoft Office VBA Patch Utility
      • MicroStation BASIC FAQ
      • MicroStation BASIC Limits [FAQ]
      • MicroStation Developer Documentation and Example Code
      • MicroStation Programming Advice
      • MicroStation SDK
      • MicroStation V8 Programming Tools Readme
      • MicroStation V8 VBA Programming Resources [CS]
      • MicroStation V8 XM Edition View Code Updates
      • MicroStation VBA Resources Revisited [CS]
      • Migrating Dimension Code To MicroStation V8
      • Migrating MDL Applications To Native Code
      • Mouse Wheel Events And The Visual Basic 6.0 IDE
      • Porting MDL Applications To MicroStation V8
      • Reading Elements From A Microsoft Access Database With VBA [CS]
      • Running MDL Applications
      • Scanning For MicroStation V8 Elements In VBA [CS]
      • Unleash A Workspace Wizard Automating Workspace Creation With MicroStation V8 And VBA [CS]
      • Using VBA To Detect The Current Or Last Used Command
      • Using VBA To Programmatically Export A VBA Project [CS]
      • Using VBA To Programmatically Import A VBA Projects Components And References [CS]
      • VBA -- Creating A Complex Application
      • VBA Interface Error: failed creating the comp manager - 0x80040583
      • VBA interface error: unable to get IDE
      • vba recording
      • Working With Levels In MicroStation VBA [CS]
      • Writing An MDL Application To Output Custom Placemarks To Google Earth
      • [V8i C++] PointCloud IPointCloudChannelDisplayHandler
    • +Visualization Wiki

     
     Questions about this article, topic, or product? Click here. 

    Debugging Native Code MDL Applications

      
     

    This Client Server article is republished in its entirety from 2004 for reference purposes.

    By Michael Dougherty, Senior Developer Support Analyst, Bentley Corporate Office
    09 August 2004

    One reason to build native code MDL applications is their ability to utilize Microsoft's tools, such as the visual debugger. However, this ability may not be apparent if you're building the application using Bentley's Make utility and Make files. Setting Microsoft's visual debugger to debug native code MDL applications is a fairly simple process, and this article will provide the steps to accomplish this.

    Compiling For Debug

    The first step in debugging an MDL application is compiling it for debug. This will put the debugging information into the executable, (or .pdb file) for the .ma, .dll, and exe. To accomplish this using Bentley's development environment you will need to utilize the -ddebug switch.

    Example: bmake -a -ddebug myapp

    Connecting to MicroStation

    Debugging a native-code MDL application (DLL) using Microsoft's Visual Debugger is the same as debugging any other DLL. The first step is to start Microsoft's Visual C++ and beginning the process to attach (in this case start MicroStation). To connect to the MicroStation process, select Build > Start Debug > Attach to Process from Microsoft's Visual C++ menu. You will be presented with a dialog. Select ustation.exe.


    An alternative method to connect to the MicroStation process is to connect through the MicroStation development shell. To connect this way, you will need to know the Process ID, which can be obtained from the Windows Task Manager.

     

    Once this is obtained, you can start Visual C++ by sending a keyin from the development shell:

    msdev -p 

    Example: Msdev -p4064

    Debugging the Application

    Once connected to the MicroStation process, you can add the application to debug. The first step is to include the application's DLL. Select Project > Settings, and select the Debug tab. Change the Category option to Additional DLLs. Select the application's DLL and click OK.

     

    Next, open the source code file for the application and set a break point. Note: The best place to set a break point is in the MdlMain function. Next, load your application from within MicroStation. When the break point is reached, your application is ready for debugging.

    See Also

    Client Server Archive

    MicroStation Desktop TechNotes and FAQs

    Comments or Corrections?

    Bentley's Technical Support Group requests that you please confine any comments you have on this Wiki entry to this "Comments or Corrections?" section. THANK YOU!

     

    • Archived Client Server
    • client server
    • client server 2004
    • Share
    • History
    • More
    • Cancel
    • Dan Koval Created by Bentley Colleague Dan Koval
    • When: Thu, Sep 5 2013 4:14 PM
    • Revisions: 1
    • Comments: 0
    Recommended
    Related
    Communities
    • Home
    • Getting Started
    • Community Central
    • Products
    • Support
    • Secure File Upload
    • Feedback
    Support and Services
    • Home
    • Product Support
    • Downloads
    • Subscription Services Portal
    Training and Learning
    • Home
    • About Bentley Institute
    • My Learning History
    • Reference Books
    Social Media
    •    LinkedIn
    •    Facebook
    •    Twitter
    •    YouTube
    •    RSS Feed
    •    Email

    © 2022 Bentley Systems, Incorporated  |  Contact Us  |  Privacy |  Terms of Use  |  Cookies