jps services
  • Home Page
  • GIS Training Courses
    • QGIS Training Courses
    • ArcGIS Training Courses
    • MapInfo Pro Training Courses >
      • MapBasic Training Course
  • About
  • Blog

MapBasic file formats: MB, MBX, MBO and MBP

17/12/2016

0 Comments

 
If you have look at a MapBasic text (*.MB) file you will see the code is in a format which could be created by many different types of text editor as well as MapBasic. However this type of text file needs to be compiled within the MapBasic program before it can be converted into an (*.MBX) which is an executable file. These executable (*.MBX) file types can then be run within the MapInfo Pro software to provide additional functionality.
Additionally, some MapBasic text files do not convert automatically to the (*.MBX) file format. This happens because they either do not have a Main() subroutine and/or the file contains routines which are declared but not defined within the file. In these circumstances the files will be compiled as (*.MBO) files. These compiled module files will not run within MapInfo Pro unless they are linked together within a project file. The project file format has the (*.MBP) file format.

So why does MapBasic have these different file formats? Some programs are fairly straight forward and can be completed with little code. In these circumstances everything can be included within the one program to make it run as an executable. Once programs become more complex then it makes sense to break up the tasks into a modular format and hence the development of the (*.MBO) format to facilitate this need.  
Another reason for having modular programs is so that code can be reused as required in different programs. The modular program also has the advantage of enabling modifications to be made to a specific part of the program without this impacting on the rest of the code. Error checking can be confined to only those modules with elements of code which have been upgraded or modified. All the other modules are therefore unaffected and only need to be linked together to create a new program once the specific module has been successfully compiled as an (*.MBO). By using modules rather than having one long complex program you can also make your subroutines and functions specific to certain tasks. This makes your code simpler to write and maintain.

Here is an example of the project file format:-

Picture
Note you can choose any name for your executable file although usually it relates to the program's application name. In the RibbonCustomizationMB.mbp the application name is the same as one of the (*.MBO) files: RibbonCustomizationMB.mbo. In the above example two files are linked to form the executable file.   
Picture
The link will succeed if both modules have been compiled as (*.MBO) files. Compile the RibbonCustomizationMB.mb file to create the (*.MBO).
​
Picture
 Then repeat the process with the RibbonCustomizationMBAddin.mb file.

Picture
Save the file as a project file.
Picture
So to create an (*.MBP) file start by opening a new file within MapBasic. Then type [link] on the first line. On the next line type your chosen application name. Here in the following example the name chosen is Application = Anyname.mbx. So the format looks something like the following:-

[link]
Application = Anyname.mbx
module=yourfirstapp.mbo
module=yoursecondapp.mbo
module=yourthirdapp.mbo

Once this file has been successfully linked in MapBasic and saved as a project file (*.MBP) an executable file called Anyname.mbx is created which can be run within MapInfo Pro.

0 Comments

Your comment will be posted after it is approved.


Leave a Reply.

    Author

    Joe Short BSc has been involved with various mapping solutions for over twenty years.  If you are considering implementing a GIS  or have ArcGIS Pro, MapInfo Pro or QGIS training requirements, jps services would be happy to be of assistance to your organisation. 

    Archives

    April 2020
    March 2020
    October 2019
    September 2019
    August 2019
    July 2019
    March 2019
    November 2018
    October 2018
    August 2018
    July 2018
    November 2017
    October 2017
    September 2017
    July 2017
    February 2017
    January 2017
    December 2016
    November 2016
    October 2016
    May 2016
    February 2016
    September 2015
    August 2015
    April 2015
    February 2015
    November 2014
    October 2014
    July 2014
    June 2014
    May 2014
    March 2014
    February 2014
    December 2013
    November 2013
    October 2013
    September 2013
    August 2013
    June 2013
    May 2013
    April 2013
    February 2013
    December 2012
    October 2012
    September 2012
    August 2012
    July 2012

    Categories

    All
    Arc Gis
    Arcview
    Autodesk
    Cad
    Gis Training
    Local Government
    Mapbasic
    Mapinfo
    Quantum Gis
    Relational Databases
    Saga Gis

    RSS Feed