Hello,
I am on a migration project from V8i (native C) to CONNECT.Different messages found on different forums are not clear for me... The existing project is composed of 50000 lines of code - native C.My goal is to minimise the changes to complete the migration.==> The main question is "are native C projets still supported with CONNECT edition ?"
It seems that the migrate tool is *just* a string remapping from old V8i/C to CONNECT/C++.For example, the constant 'UNIT_ANGLE_Radians' is remapped by 'StandardUnit::AngleRadians'Surely this kind of syntax cannot be compiled in C file (but in a C++ file).How can I use this tool if I want to stay in native C ?
It seems that the provided makefiles are not working with .C extension files.The following message is displayed when the source file is a .C one : "This file is for C++ compilands only"Is there a way to use those makefiles (with a define or someting) or are there specific makefiles available ? On the other hand MicroStationCONNECTSDK\include\Mstn\MdlApi contains the needed .H (and .FDF) files with the 'C' functions prototypes.For example 'mdlScan_initialize()' defined in msscan.fdf found in V8i SDK and CONNECT SDK.So to me it must be a way keep using those old 'native C' API... No ?
Thanks a lot, Pascal.
Hi Pascal,
Pascal Moron said:Different messages found on different forums are not clear for me...
For several years, there is only this MicroStation Programming forum, plus BDN forum (that should be used for BDN specific discussions). Any other "MicroStation programming" forum is probably obsolete and not containing the latest topics.
Despite of few years old, the most complex overview of migration topics is MicroStationCONNECT_MigrationWorkshop.pptx delivered with MicroStation SDK.
What can be confusing a bit is that the migration in fact consist from several different tasks:
Pascal Moron said:The existing project is composed of 50000 lines of code - native C.My goal is to minimise the changes to complete the migration.
To minimize changes is valid target, but because it has to be migrated to new API, some amount of changes is always required. How big the change should be (50 000 is still smaller C project) depends how code structured and how tightly it depends on MicroStation API. My experience is that in some situations it makes sense to rewrite substantial portions of original code, whereas in some others, mostly mechanical substitution changes are enough.
Pascal Moron said:The main question is "are native C projets still supported with CONNECT edition ?"
I think Robert Hook will be able to provide better and more detailed answer, but in my opinion the answer is "no". MicroStation CE API is strongly typed C++ API, so you have to compile your code as C++ (.cpp extension) and to modify the code accordingly to API requirements. On the other hand, the most of C code is also valid C++ code (this is technically complicated topic, depending also on used C/C++ compiler ;-), so the first step in the migration is about to rename .c to .cpp.
Pascal Moron said:It seems that the migrate tool is *just* a string remapping from old V8i/C to CONNECT/C++.
Yes, it's exactly what the tool does: It saves some time and effort helping rename code where 1:1 remap rule exists. Nothing more, not rewriting the code to work with the new API ;-)
Pascal Moron said:For example, the constant 'UNIT_ANGLE_Radians' is remapped by 'StandardUnit::AngleRadians'
Yes, and the reason is explained in PowerPoint I mentioned above: It's about more strict API, when C-style using macros and int constants (which cannot be checked by compiler for a validity) were changed to enums (not available in C).
Pascal Moron said:How can I use this tool if I want to stay in native C ?
What exactly do you want and why? Do you want to use something like "pure C compilation", which I guess is not simple even in Visual Studio (and not supported by MicroStation API), or to write C code (with C++ constructions where it's required by MicroStation API) that is later compiled as C++?
Pascal Moron said:It seems that the provided makefiles are not working with .C extension files.
It's correct finding. MicroStation API is C++, so it's expected source files will use .cpp extension (the same expectation as Visual C compiler use).
Pascal Moron said:So to me it must be a way keep using those old 'native C' API... No ?
I am not sure, but based on my C++ dev knowledge (which is currently worse than C# and NET Framework knowledge), it's not possible and I see no reason why to try to hack the prepared ecosystem for such functionality. There is a new API available in MicroStatio CE, providing much better functionality, plus more restricitve (strongly typed) API leads to better code. Why to try to find workaround to use it in a different way?
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Jan Šlegr said:Pascal Moron said:So to me it must be a way keep using those old 'native C' API... No ? I am not sure, but based on my C++ dev knowledge (which is currently worse than C# and NET Framework knowledge), it's not possible and I see no reason why to try to hack the prepared ecosystem for such functionality. There is a new API available in MicroStatio CE, providing much better functionality, plus more restricitve (strongly typed) API leads to better code. Why to try to find workaround to use it in a different way?
Yes it is possible, because C is a still a subset of C++. You could formally change your makefiles, etc. from C to C++. It works.
But is it wise? Even if you do so, and rename everything with the migration tool, I would guess your fulfillment would be at optimistic 5% - 10%.
I would recommend to take your time, analyse your code and functionality, and then decide wicht part could be migrated, and for what part ist would be easier (less working-time => less cost) to create new.
Mit freundlichen Grüßen / Best regards Volker Hüfner
| AB_DATE Engineering Software | ab-date.de |