DCSIMG
December 2007 - Posts - Pavel's Blog
Sign in | Join | Help

Pavel's Blog

Pavel is a software guy that is interested in almost everything
software related... way too much for too little time

December 2007 - Posts

Working with C++/CLI

Published at Dec 18 2007, 05:19 PM by pavely

I like C++/CLI. I think the ability to write native code along managed code is a great benefit. Especially when I have so many existing C++ native projects (MFC & ATL). However, this needs to be done somewhat carefully.

Microsoft says all you have to do to enable managed code in a C++ app is to click Project->Properties, change in the General section to allow managed code (/clr being the most useful option) and voial! IJT (It just works). Technically, that's mostly true (mostly, because in one instance some unknown code called ::CoInitializeEx(0, COINIT_MULTITHREADED) before my MFC InitInstance method executed, causing the main thread to enter the multithreaded COM apartment. Then MFC's AfxOleInit which calls ::OleInitialize - tried to enter the STA failed of course as the apartment of the thread cannot changed once established. Calling CoUninitialize is no solution either, as it will throw away all COM objects in the current apartment. Also, if you have inline assembly or varargs stuff IJT will fail too. Nevermind...)

If you try this on a medium-big MFC project, for instance, you'll find out that the "Linking" phase takes a minute or two on a capable machine. Wondering why, you take a peek at the output file and note that it has grown from something like 4MB to more than 150MB! All that metadata of all unmanaged types wrapped up in managed code!

The solution to this is somewhat more difficult, but well worth the trouble. Don't enable the /clr option globally. Rather, enable it on per file basis in which you need to call managed code. You'll have to get rid of the precompiled header too, but that's a small price to pay. Then, to be extra compact, you can wrap the managed functions/types in #pragma managed/unmanaged to better control the compilation mode. This way you get all the benefits without (almost) all the baddies.

I do like C++/CLI!

 

XNA Game Studio 2.0 Released!

Published at Dec 13 2007, 01:18 PM by pavely

 

ממש היום שוחררה הגרסה הסופית של XNA Game Studio 2.0 וניתן להוריד אותה מהלינק בתחתית הפוסט. למי שלא מכיר, ה-XNA Game Studio מאפשר כתיבת משחקים על PC ועל XBOX 360 עם גרפיקה דו/תלת מימדית, סאונד, תקשורת, INPUT וכל שאר המרכיבים של משחקים מודרניים תוך שימוש בספריית NET. נוחה וחזקה. האלטרנטיבה היתה כתיבת משהו יותר Low Level כגון שימוש ב-Managed DirectX או לאמיצים יותר - שימוש ב-Native DirectX או ב-OpenGL.

יש מספר שיפורים משמעותי ביחס לגרסה 1, לפחות בעובדה שניתן להשתמש ב-Visual Studio 2005 המלא ולא רק ב-Visual C# 2005 Express. לצערי, Visual Studio 2008 לא נתמך משום מה (גם לא בגרסת ה-Express).


XNA Game Studio 2.0 Download

Course and Videos

Published at Dec 06 2007, 05:41 PM by pavely

Hi-Tech college has recently posted a few videos on system administration and software development. My own 3 videos are there on .NET topics. They can be viewed here.

On a related note, I'll be teaching an Advanced .NET with C# Course through Hi-Tech college on the 25-27 of this month. The syllabus can be found here by searching for the course number 4151.

Happy Hanuka! 

MFC לכל אוהבי

Published at Dec 04 2007, 09:07 AM by pavely

ללא ספק עם כניסת ה-.NET לחיי הפיתוח, נזנחו במידה מסוימת לפחות טכנולוגיות Native, כגון MFC. MFC לא התקדם כמעט בכלום מאז גרסה 6 (שהגיעה עם Visual C++ 6). בגרסה החדשה ביותר (9) זו שמגיעה עם Visual Studio 2008 לא שונו דברים משמעותיים. הדבר העיקרי שהשתפר הוא התמיכה ל Look & Feel של ויסטה (למשל CFileDialog מציג את הגרסה החדשה של ויסטה ולא הגרסה הישנה). כל מי שרצה לעשות דברים יותר מודרניים עם ה-UI נאלץ לכתוב הרבה קוד בעצמו, או לקנות חבילה כזו או אחרת שמרחיבה את MFC (או משתמשת ב-ActiveX Controls).

בשורות טובות הגיעו מכיוון רדמונד. MFC הולך לעבור שדרוג רציני, כולל תמיכה באלמנטי UI מודרניים, כגון ה-Ribbon של Office 2007 והחלונות הניתקים של Visual Studio. כל זה הולך לקרות בשיתוף עם חברת BCGSoft, יצרנית של חבילת UI הבנויה על MFC. השדרוג המלא צפוי מתישהו ב-Q1 של 2008, אבל גרסת ביתא צפויה לצאת כבר בינואר. יש למה לחכות!

Developer Academy II Presentation and Demos

Published at Dec 03 2007, 10:58 AM by pavely

I'll be blogging in Hebrew and English alternatively, just for my own twisted fun.

Here is the presentation and demos of the ASP.NET AJAX Nuts & Bolts lecture I have at Developer Academy II. The demos cannot be run as is, at least because a database is required containing a table called Atlas, which has a Country and a City columns. But, it's probably beneficiary to view the LINQ to SQL code and the various JavaScript code snippets.

ASP.NET AJAX Nuts & Bolts presentation

Demos

שלום !

Published at Dec 02 2007, 12:13 PM by pavely

שמי פבל יוסיפוביץ', CTO ואחד המקימים של חברת הסטארט-אפ MentorWave Technologies וכן ראש תחום פיתוח במכללת היטק ומרצה במכללה.

זהו הפוסט הראשון שלי (הידד!), אין ברירה כנראה, צריך לכתוב כמה דברים לקהילה, נראה שכולם עושים את זה, אז למה לא אני?

הדבר המרגש יחסית שקרה לאחרונה זו הרצאה שהעברתי ב-Developer Academy II ביום שלישי שעבר. זה היה משהו של הרגע האחרון במובן מסוים, אבל נראה שעבר בשלום. ההרצאה עסקה ב-ASP.NET AJAX ומי שלא היה (וגם מי שהיה) יוכל לצפות בהקלטה בעוד כשבוע-שבועיים (לראות ולשמוע את הפאשלות הקטנות).

תחומי העיסוק שלי הם .NET (ברור...) אבל גם טכנולוגיות יותר ותיקות (בעיקר COM, MFC, ATL, Win32) אבל גם DirectX, Device Drivers (WDM, KMDF) ועוד כמה דברים יותר מוזרים שאפרט בבלוג עתידי.

בהצלחה לכולנו!