Category: Compilation & Linking
How do I set up a Visual Studio project which uses proxy types from scratch?
You can start out with any Visual Studio project type, but you will have to make certain modifications. Some options might be set up already by default, others will definitely need to be configured:
|Preprocessor include path
||You need to add the Codemesh runtime include directory (cpp/include) to the preprocessor include path.|
|Declspec macro||You might have to define the declspec macro that is used to export the proxy types from their DLL (more on that below).|
|Runtime Type Information||The proxy types rely on RTTI being enabled (/GR) .|
|Exceptions||The proxy types rely on exceptions being enabled (/EHsc or /GX).|
|Library search path||You need to add the Codemesh runtime library's directory to the search path (cpp/win32-all-x86).|
|Libraries||You need to add the Codemesh runtime library (xmogrt.lib) to the project.|
This usually results in the following options (<installdir> represents the directory containing your Codemesh product):
/I"<installdir>/cpp/include" /GR /EHsc or /GX /LIBPATH:"<installdir>/cpp/win32-all-x86" xmogrt.lib
The declspec macro
The value of the declspec macro depends on whether you're including proxy classes in your project as source code or by referencing an external library which contains them. All proxy types are generated with a macro that can be defined to one of three possible values:
When the macro is defined to this value, the declared types are exported from the project. This usually only makes sense for DLL projects.
When the macro is defined to this value, the declared types are imported into the project. This can make sense in all project types but only if the proxy types that are being imported are exported from a DLL.
When the macro is defined to empty, the declared types are not going to be available outside of the project. This is usually appropriate for executable projects or for library projects that use the proxy types as utility types without wishing to expose them to the outside.
Unless you're dealing with a customized set of options, the default name of the declspec macro is CMJ_DECLSPEC and it defaults to the empty value, essentially: