Visual Studio2008을이용한...

42
김용현 김용현 www.YHKim.com www.YHKim.com Microsoft MVP Microsoft MVP Chief Programmer, ESTsoft Visual Studio2008을 이용한 C++코드의 견고한 업그레이드

Transcript of Visual Studio2008을이용한...

Page 1: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

김용현김용현 www.YHKim.comwww.YHKim.comMicrosoft MVPMicrosoft MVP

Chief Programmer, ESTsoft

Visual Studio2008을 이용한C++코드의 견고한 업그레이드

Page 2: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 2

유츠프라카치아

Page 3: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 3

Windows with Native VS .NET

.NET Framework 성공, 그러나Native C++이 합리적인 경우가 많음C++은 Windows SDK를 이용해 Windows의 모든 부분을 자유롭게 엑세스 할 수 있는 유일한언어VC++ 2008의 업데이트쯤에서 대대적인 업그레이드가 이루어짐

Page 4: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 4

Agenda

Overview on new VC++편리한 사용성 지원추가된 컨트롤 지원MFCNext표준 라이브러리 확장

Page 5: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 5

Overview

Visual C++ 2008 컴파일러는 OOO를 지원CLR(Common Language Runtime)x86, x64, Itanium최적화 지원

Visual C++ 2008 라이브러리는 OOO를 지원ATL, MFC, Standard C++ Library, STL, C Runtime Library, STL/CLR

http://msdn2.microsoft.com/en‐us/library/60k1461a.aspx

Page 6: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 6

ATL, MFC, Win32에서 생성되는 다이얼로그는Vista style 가이드라인이 반영이 됨

Vista Style Guidelines

Page 7: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 7

Vista Style Guidelines

Aero 테마, 공용컨트롤, 공용 다이얼로그,작업관리자, Glass 효과, Aero Wizard, 시스템 폰트, 검색 상자, 에러메시지 다이얼로그, …비스타 지원

새로운 컨트롤, 이벤트, Notification, 스타일에 대한MFC 지원

Page 8: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 8

Class Designer

2005에서 .NET 지원 언어들에게 지원되어졌음Office등과 쉽게 연동되며 클래스 drag-drop 등으로 쉽게 사용아쉽게, Read Only

Page 9: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 9

Class Designer

class A {};

class CCustomClass: public A {public: int a; int b;private: int c; int d;};

Page 10: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 10

IDE Upgrade

Page 11: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 11

IDE Upgrade

Page 12: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 12

IDE Upgrade

Page 13: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 13

IDE Upgrade

Page 14: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 14

IDE의 향상

Solution Load Performance 향상Editor Responsiveness 향상IntelliSense Responsiveness 향상

NCB파일의 동기화 부분 수정더 이상 코딩을 멈추는 방해를 하지 않음최악의 상황에서도 CPU사용률이 90%미만

프로젝트 사이즈가 XXL라도 유연하게 동작

Page 15: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 15

IDE의 향상

Page 16: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 16

병렬 Unit 컴파일옵션{/MP(n)}

CPU가 병렬적으로 프로젝트 컴파일Tools > Options > Project and Solutions > Build and Run > parallel project builds 에서 병렬적 빌드프로젝트의 개수 선택 가능Dependency가 있는 프로젝트는 적용이 안됨실제 프로젝트 운용상 유명무실, 복배지모!

/MP(n) switch빌드의 프로세스의 개수를 Hard Coding할 수 있음Cpp등의 유닛단위로 적용

셋팅에 따라 30% 상하 이상 콤비네이션 효과

Page 17: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 17

보안을 위한 컴파일러 옵션

ASLR(Address Space Layout Randomization)라이브러리적재위치, 스택, 힙의 시작위치를 랜덤화/DYNAMICBASE

DEP(Data Execution Prevention)Execute Disable, Enhanced Virus Protection폰노이만구조의 한계/NXCOMPACT

Page 18: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 18

IDE의 비스타 지원

비스타에서 VS2005 개발환경을 꾸미면 번거로운 과정이 들어감

Hotfix for VS2005 – ENU(KB929470) 제거VS2005 ServicePack1 with Vista 설치Run as Administrator 로 수행을 권장간단한 테스트 애플리케이션을 작성할 때도 뜨는UAC가 상당히 신경 쓰임VS2005 자체가 Vista 애플리케이션 개발 가이드라인에 맞지 않는 애플리케이션이 되어 버림

Page 19: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 19

처음부터 Run as Administrator 불필요User 권한에서도 개발 가능Administrator 권한이 필요할 때만 UAC를 통해권한 획득

IDE의 비스타 지원

Page 20: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 20

UAC 지원하기 – OLD WAY

<?xml version='1.0' encoding='UTF-8' standalone='yes'?><assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>

<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"><security><requestedPrivileges><requestedExecutionLevel level="asInvoker" uiAccess="false" /> </requestedPrivileges></security>

</trustInfo></assembly>

mt.exe -manifest 1.manifest 2.manifest -outputresource:MyApp.exe

#define MANIFEST_RESOURCE_ID 1MANIFEST_RESOURCE_ID RT_MANIFEST “AdminApp.exe.manifest”

Page 21: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 21

UAC 지원하기 – NEW WAY

Project > Properties > Linker > Manifest File관련 UI 제공/MANIFESTUAC

/MANIFESTUAC/MANIFESTUAC:NO/MANIFESTUAC:level={asInvoker|

highestAvailable|requireAdministrator}

/MANIFESTUAC:uiAccess={true|false}

Page 22: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 22

추가 지원되는 컨트롤 기능

커맨드 링크 컨트롤스플릿 버튼

BS_SPLITBUTTON 설정

Network AddressIPv4, IPv6, DNS etc..

시스템 링크콤보 박스 컨트롤트리뷰

다중선택, 더블 버퍼링

Page 23: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 23

그밖의 변경사항

ATL Server가 CodePlex로 릴리즈 됨Atlenc, atlutil.h, atlpath.h 지원안함

Intel Core Architecture 지원__cpuid함수 업그레이드

최신 버전의 AMD 및 Intel 프로세서의 향상된 기능지원

/Wp64, __w64 무효화

Page 24: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 24

CRT,STL의 변경사항

Windows2000 아래의 운영체제 지원 중단Windows 95/98/ME, Windows NT4.0

CRT의 일부 함수 삭제_osplatform, _osver, _winmajor, _winminor, _winver_get_osplatform, _get_osver, _get_winmajor, _get_winminor, _get_winverSAL의 문법 변경

Page 25: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 25

AfxBeginMFCIsBack()

새로 추가된 새로운 Native API 활용깔끔한 사용자 인터페이스새로운 Native API의 래핑을 지원하는 것과 동시에 새로운 컨트롤 및 공용 대화상자 등의 추가제공

150개가 넘는 Method와 18개의 새로운 클래스가Vista를 feature지원을 위해 더해짐기존 코드보다 성능 향상

Page 26: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 26

MFCNext

MFC의 향상된 기능은 대부분 UI에 집중MFC 프로젝트를 VC9에서 다시 컴파일 하면 Windows Vista에 맞게 모양 자동 최적화EX) bVistaStyle 추가 파라미터 전달

CFileDialog dlgFile(TRUE);

dlgFile.DoModal();

Page 27: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 27

Support Office&VS&IE style

Page 28: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 28

MFC 9.0에서 새로운 것들

Visual style Application UI 빌드가 가능Microsoft OfficeVisual StudioInternet Explorer

다양한 UI 구성 요소들 지원Toolbar 커스터마이징메뉴, 키, 메뉴바, Docking Panes

다양한 스킨 지원XP, Vista, Office2003, Office2007 (blue, black, aqua…)

Page 29: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 29

Office Interface

Page 30: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 30

IE Interface

Page 31: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 31

Visual Studio Interface

Page 32: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 32

새로운 형태 컨트롤 지원

막상 구현하려면 막막한 여러 컨트롤 지원

Page 33: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 33

MFC9.0 모습 및 변화

Page 34: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 34

MFC 9.0에서 변화된 것들

CTime 클래스의 처리 날짜 확장 변경ActiveX컨트롤을 삽입후 탭오더 변경 버그 수정CFileDialog의 컨트롤 ID가 변경CWnd::GetMenuBarInfo 메소드 삭제

CFrameWnd::GetMenuBarInfo의 Virtual 속성 없어짐

CHttpServer가 없어짐ISAPI(Internet Server Application Programming Interface)를지원하지 않음

ANSI MFC 메소드를 Unicode로 변경 권장Visual Manager는 MBCS과 Unicode를 모두 지원하지만Windows Control를 래핑하면서 Unicode만 지원하게 됨

Page 35: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 35

Known Uses

Page 36: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 36

StandardCppLibraryIsExtended()VS2008VS2008에에 포함된포함된 TR1TR1항목들항목들shared_ptrshared_ptr, , weak_ptrweak_ptr

mem_fn()mem_fn(), , bind()bind(), and , and functionfunction

정규정규 표현식표현식 regexregex

<random><random>Containers (Containers (tupletuple, , arrayarray, , unordered_setunordered_set , etc.), etc.)

<type_traits><type_traits>

reference_wrapperreference_wrapper

포함되지포함되지 않은않은 항목들항목들C99 Compatibility (C99 Compatibility (<cstdint><cstdint>, etc.), etc.)

Special Math Functions (Special Math Functions (riemann_zeta()riemann_zeta(), etc.), etc.)

Page 37: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 37

Visual Studio 에서

TR1TR1에에 대한대한 정책정책

Visual C++ 2005 (VC8)Visual C++ 2005 (VC8)에는에는 포함시키지포함시키지 않을않을 것임것임

VC9 Express VC9 Express 버전에는버전에는 포함포함 안됨안됨

Visual C++ 2008 (VC9) RTMVisual C++ 2008 (VC9) RTM

별도의별도의 patchpatch를를 설치설치 하면하면 VC9 RTMVC9 RTM에에 포함포함 됨됨

VC9 SP1 VC9 SP1 과과 이후이후 버전에는버전에는 포함포함 됨됨 (VC10, (VC10, ……))

Page 38: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 38

TR1 구성요소

TR1 TR1 의의 구성구성 요소요소<regex><regex>와와 같은같은 새로운새로운 헤더헤더 파일파일 셋셋

<memory><memory>와와 같은같은 기존기존 헤더의헤더의 수정수정 파일파일 셋셋

msvcp90[d].dll msvcp90[d].dll 의의 수정수정 파일파일 셋셋

기존 콤포넌트들과 분리되어 있는 요소헤더 파일만 추가 한다고 TR1을 사용할 수 없음msvcp90[d].dllmsvcp90[d].dll와와 같은같은 파일과파일과 쌍으로쌍으로 움직여야움직여야 함함

MFC UpdateMFC Update와와 TR1 UpdateTR1 Update는는 별개임별개임

Page 39: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 39

TR1 differ from Boost

라이선스라이선스 정책정책BoostBoost는는 오픈소스오픈소스, TR1, TR1은은 DLL Library DLL Library 정책에정책에 따름따름

BoostBoost의의 모든모든 요소가요소가 TR1TR1에에 포함포함 된된 것은것은 아님아님일부일부 regex regex 문법문법, shared_array , shared_array ……

최적화최적화 (e.g. vector<shared_tr<T> >)(e.g. vector<shared_tr<T> >)기존 STL과 같이 사용할 수 있도록 리포지셔닝/clr, /clr:pure, /W4, /Za, /Gz, /anlayzeSTL에서 처럼 IDE Debugger Visualizer에서TR1 type은 강하게 연동됨

Page 40: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 40

추가된 헤더파일

<array><functional><memory><regex><tuple><type_traits><unordered_map><unordered_set><utility>

Page 41: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 41

Reference

VC++2008 Feature Pack Beta Documentation

C++ 표준 라이브러리 확장 튜토리얼 및 레퍼런스 - Pete Becker, 지&선

http://open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf

http://blogs.msdn.com/vcblog

http://channel9.msdn.com/tags/C++

http://blogs.msdn.com/somasegar

Page 42: Visual Studio2008을이용한 C++코드의견고한업그레이드pds8.egloos.com/pds/200803/31/77/p32009.pdf · 2008-03-31 · 3/12/2008 3 Windows with Native VS .NET .NET Framework

3/12/2008 42

Thank you이후 피드백

http://www.devpia.com/MAEUL/Contents/List.aspx?BoardID=4246&MAEULNo=4 Software Architecture와 Pattern 관련 Study 및 Online 토론Software Architecture와 Design Pattern 관련 Q&A