Roy,
We recomend that you use VisualStudio 2005 for developing NativeCode applications.
HTH,
Mark Anderson [Bentley]
mark anderson [Bentley]
Visit me at https://communities.bentley.com/communities/other_communities/bentley_innovation/default.aspx
I happen to have MicroSoft VS2005 Pro, so I am interested in using it for mdl. But I have not the slightest idea how to do that. There are some projects for NativeCode in the examples; I tried to compile "cellexp", but I didn't succeed at all (I must also confess that I cannot get on very well with the Bentley-style makefiles). Would there by any chance be an example project to show how to use VS2005?
regards, Jan Willem
Hi Jan,
Make a copy of the mstndevvars.bat file and give it a name that defines the version of Microstation that it will be used with, as you can do this for all versions, not just V8i. Edit the file and add the following line to the end of it.
"C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.exe"
Next, create a shortcut to your new batch file (I've got mine on my quickstart bar), right-click to go to the shortcut properties and add the following line to the 'Target' line.
"C:\Documents and Settings\jwillem\My Documents\Visual Studio 2005\VS2005_V8i.bat" "C:\Program Files\Bentley\MicroStation V8i\MicroStation\" "C:\Program Files\Bentley\MicroStation V8i\MicroStation\"
I also change the icon to help identify the version of Microstation this shortcut is used with, but... That's it. This shortcut will open Visual Studio and set up all the relevant paths etc for MDL development.
P.S. you may also want to add the path for the MDL header files to your projects (Project->Name Properties->Configuration Properties->C++->General->Additional Include Directories), to give you the browse and intellisense information.
"C:\Program Files\Bentley\MicroStation\mdl\include"
Micheal
Hi Jan Willem,
lets divide your problem into 2 areas: How to compile examples delivered with MicroStation SDK and how to wrote your own native code application:
Cellexp and other delivered examples: What happen if you start MicroStation Developer Shell (Bentley V8i > MicroStation V8i SDK > MicroStation Developer Shell), go to cellexp directory and compile the example with bmake cellexp command? If both your MicroStation and VisualStudio installations are fine, the application should be compiled without error message.
It is recommended to compile the application not from VisualStudio, but from Developer Shell with bmake, as both Shell and bmake do a lot of work for you. Until you will be not able to compile standard examples, I think it is not good to start own development, as the successful compilation is a proof that your installation and configuration are fine.
Native code application development: There are some material available on Wiki, e.g. BDN articles (http://communities.bentley.com/Administrators/Wiki/w/Wiki/bdnzine-articles.aspx) like MDL - Native Code Application Development. And of course check BDN forum (http://communities.bentley.com/Programs/Bentley_Developer_Network/f/267.aspx).
HTH Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Jan: I happen to have MicroSoft VS2005 Pro, so I am interested in using it for MDL.
When you write an MicroStation Development Library (MDL) application using Visual C++, you aim to create a DLL. You will:
Some resource data can continue to live in (.r) files that you compile using the Bentley tools. For example, you can implement dialog boxes using MDL resources or use Microsoft Foundation Library (MFC) or Windows Template Library (WTL) resources. It's also moot whether you should store messages in MDL (.r) files or VC++ string tables.
There's some information about:
Regards, Jon Summers LA Solutions
hello Jon, Jan and Michael,
I am going to try all of your suggestions in a couple of days. I am very curious. Thanks a lot.
Jan Willem
I forgot to mention how to set up an external tool for the bmake command. Go to Tools->External Tools... to open the External Tools dialog. Click the Add button and enter the following and uncheck all options except for Use Output Window:
Title: Bmake
Command: C:\Program Files\Bentley\MicroStation V8i\MicroStation\mdl\bin\bmake.exe
Arguments: -lw $(TargetName)
Initial Directory: $(ProjectDir)
Do this for both the Bmake and Bmake All (arguments = -lwa $TargetName) commands and add buttons for these commands to a new or existing toolbar via the Customise menu.
I agree that until you know you can compile an application, use the developers shell. After that, forget it! If you compile your applications using the external tool and have the Use Output Window checked, all error messages are directed to the output window and can be double-clicked to drive you directly to the error (rather than wading through the output in the developers shell and entering line numbers with the Ctrl+G command).
hello guys,
Thanks to your input I am able to smell at compiling to native code, and using Visual Studio. Above all, I like the la-solutions article that Jon indicated. Also, I found http://www.sumbera.com/ustation/tutorial/tonative.htm very informative, although it is a little bit older, and it deals with Visual Studio VC6.
In order to go further, I have to understand compiling Bentley-style makefiles and that is a big deal. I have been programming mdl for some fifteen years now, always using prehistoric-style makefiles, and keeping miles and miles away from any Bentley .mki-file. I am able to tell a prehistoric-style makefile where MicroStation is, where rcomp, mcomp etc are, what the dependencies are, where the includefiles are, where the libraries are, where the input is, where it must put the output.
But for nativecode, I must go Bentley-style, because translating the necessary commands and options to prehistoric-style makefiles looks even more impossible to me.
I tried now again, to compile Bentley-example "circuit". No native-code or Visual Studio yet. After a hard struggle, I was able to get it compiled for MicroStation XM. But for V8i: nope. In spite of many hours trying, I keep getting punished with different kinds of problems. If someone could have a look at the files in next zip, (there is an output capture) and do a suggestion of a solution, I would be most gratefull.
http://communities.bentley.com/Other/Old_Site_Files/Member_Folders/m/tamaness_files/default.aspx
In this zip, try1_circuitcomp.bat and try1_circuitcomp.mke produce try1_produced_make.opt and try1_circuitcomp_output.txt on my computer. The problem seems to be that bmake produces a make.opt with empty lines with only -i, but I cannot find which variable should be defined where to make it work. I cannot find a clear document about this, neither (such as the MDLProgrammerGuide.chm) With other tries, I had different but likewise results.
In case you wonder what I mean when talking about a prehistoric-style makefile, I made prehistoric_circuitcomp.bat and prehistoric_circuitcomp.mke and yes,that compiles for V8i on my comp.
Also, it would be interesting to know if I am the only one who sees the Bentley-style makefile as such a complete disaster, and if the whole world is compiling them happily.
I suggest that you take a step back and use the developer shell that ships with the sdk. You do not need to set up all of the environment it is done in the mstndevvars.bat file. Next I would use the .mki files that we ship as we look for where VisualStudio is installed and set the paths for those tools correctly (according to the registry ). There are a number of native code examples delivered with the MicroStationVii SDK. Once you can compile in the developer shell that we ship you can make a copy of it and then add to input parameters (or more) to allow passing in the various parameters to control compiling. Looking at the files that you posted you have the classpath set (which is no longer needed) and your questions on setting of MS is so we know where the toolsubs library is since rcomp etc depend on that dll. There is a lot of documentation on the make file syntax in the programmers guide. For all the native code stuff I refer to the old dlm section and then look at the dlmlink.mki file when things don't work right.
Thanks a lot for going into this, Mark.
But how do I use the developershell? What IS the developershell? Is that mstndevvars.bat? If I run that one, from a commandwindow, it wants two parameters (msdir and something with MicroStationSDK at the end; but I don't have any MicroStationSDK in my paths. I have run the SDK setup twice.
I am really circling through these basic issues without finding the answers.
I am not yet trying to compile nativecode, just to compile a Bentley V8i example; with my own makefile I can, with the Bentley version I can't. Could it be that something got mixed up because of my three MicroStation-versions?