Compilation and Execution Differences

While the Intel® C++ Compiler is compatible with the Microsoft* Visual C++* compiler, some differences can prevent successful compilation. Also there can be some incompatible generated-code behavior of some source files with the Intel® C++ Compiler. In most cases, a modification of the user source file enables successful compilation with both the Intel® C++ Compiler and the Microsoft* Visual C++* compiler. The differences between the compilers are listed as follows:

Inlining Functions Marked for dllimport

The Intel® C++ Compiler will attempt to inline any functions that are marked dllimport but Microsoft will not. Therefore, any calls or variables used inside a dllimport routine needs to be available at link time or the result will be an unresolved symbol.

Example

The following example contains two files: header.h and bug.cpp.

header.h

#ifndef _HEADER_H
#define _HEADER_H
namespace Foo_NS { 

        class Foo2 { 
        public: 
                Foo2(){}; 
                ~Foo2(); 
                static int test(int m_i); 
        }; 
} 
#endif

bug.cpp

#include “header.h”
struct Foo2 { 
  static void test(); 
}; 

struct __declspec(dllimport) Foo 
{ 
   void getI() { Foo2::test(); }; 
}; 

struct C  { 
  virtual void test(); 
}; 

void C::test() { Foo* p;  p->getI(); } 

int main() { 
   return 0; 
}