so ΪShared ObjectµÄ¼òд¡£
½ñÌìÎÒÔÚ×ö¿çƽ̨µÄbuildʱÅöµ½µÄÎÊÌâ¾ÍÊÇÓÃSConsµÄSharedLibraryµÄbuilder£¬¿ÉÊÇÔÚÇ°ÃæµÄ±àÒë½×¶ÎÈ´²úÉúµÄÊÇ*.oµÄÎļþ£¬¶øÕæÕýÐèÒªµÄÊÇ*.osµÄÎļþ¡£
ÔÚMacÉÏÃæStaticLibraryÊÇ*.a½á⣬SharedLibrary ÔòÊÇlib**.dylib½áβµÄ¡£
(2) ½ñÌì¶ÔlinkºÍbuildµÄ¹ý³ÌÓÐÁ˸üеÄÈÏʶ:
compiler½«*.cppÎļþbuildΪObject file, *.obj on Windows, *.o or *.os on POSIX platform;
linkµÄ¹¤¾ß»á½«ÕâЩobject file linkΪһ¸ölib»òdllµÈ¡£
½ñÌìÔçÉϺÜÔç¾ÍÅöµ½ÁËlink unresolved symbolµÄÎÊÌ⣬ÔÚÒ»¸öprojectÖÐÓ¦¸ÃÊDz»»á´æÔÚÕâÑùÎÊÌâµÄ£¬×îºó·¢ÏÖÔÀ´ÎÒÓÃSConsµÄGlobµÄ²Ù×÷ºó£¬Ã»Óн«ËùÓÐ×ÓfolderÏÂÃæµÄ¶«Î÷¶¼include½øÀ´ËùÖ¡£./win,./unixµÈÏÂÃæµÄcppûÓÐÉú³É*.objÎļþ¡£
(3) Typical preprocessor definitions:
ÒÔºó¿ÉÒԲο¼Õâ¸öÈ¥¶¨ÒåÔ¤´¦Àíºê
ÒýÓÃ:#if defined(OSWin_)
#ifdef OM_BUILD_DLL
// dll export.
#define OM_Export _declspec(dllexport)
#else
// dll import, the normal way to use the library.
#define OM_Export _declspec(dllimport)
#endif
#elif defined(OSMac_) || defined(OSLinux_)
#define OM_Export
#endif