# Sunday, 25 February 2007

One of the things that C++ can do that C# can't is MSIL linking from the IDE. Normally when you have a solution with two projects, a build creates two assemblies (one .exe and one .dll) for you to deploy. Sometimes you want to deploy only a single file, but you want two projects. Sometimes you want the advantages of static linking while you're creating MSIL and deploying onto the CLR. So how do you do it?

I created a tiny little solution with two projects, both in C++. One is a console application and the other is a library. I set the library to compile as /clr:safe and the console app as just plain /clr. In the console app I added a reference to the library.

At this point if I build and run I will have HelloWorld.exe and Library.dll.

Now I went to the Library project settings and made a few changes. First, on the Advanced tab of Linker options, I turned off assembly generation:

This gets the linker to make an assembly fragment called a .netmodule rather than an assembly. Next I changed my output file name:

Then I deleted the reference in the console application, and re-added it but this time to Library.netmodule instead of Library.dll. One more thing, the linker inputs in the console application need to include the .netmodule:

 

At this point I can build the solution, and delete Library.netmodule, Library.dll and the like and HelloWorld.exe will run just fine. I don't need to deploy Library because it's actually inside HelloWorld.exe - that's MSIL linking.

I have a mentoring client who is using this right now. They have an MFC application with a mix of native and managed code and it can't be compiled /clr:pure. They want to add some WinForms controls to that application, and the designer can only work with verifiable assemblies. So now one project is the user controls, and it's /clr:safe, and the the main exe is a mixed assembly. Yet they only deploy a single file in the end.

Kate

Sunday, 25 February 2007 19:18:55 (Eastern Standard Time, UTC-05:00)  #    
# Saturday, 24 February 2007

Man, the hits just keep on coming at Channel 9. This time it's Rico Mariani, nominally on performance but in my opinion really on how to have a successful career. Reminiscing about the University of Waterloo, computer stores in Toronto, the amazing Ontario Science Centre, and a Commodore PET (all things from my past though I didn't work at these places I just visited them) he somehow works into every sentence how being a nice person and wanting to help is a recipe for success. Later he starts talking about creative leaps and eventually about how to make your programs faster.

Want to be seen as an expert? Want to be put in charge of something? Want to make a difference in someone's life? Watch it! It's a huge download - over 800 meg - but so worth it.

Kate

Saturday, 24 February 2007 18:37:15 (Eastern Standard Time, UTC-05:00)  #    
# Friday, 23 February 2007

Who knew that picking up enough programming knowledge to teach it to talented kids at a summer camp could lead to a career doing some of the geekiest and most detailed work there is in this business - testing the compiler itself to make sure it still works the way it's supposed to? That's just one of the nuggets of information in this latest Channel 9 C++-land interview:

Meet Marina Polishchuk, a software engineer on the VC++ quality control team. Her mission: Outsmart the compiler with clever programs that confuse and or break it. Fun stuff. Here, we learn about what she does, why she does it and how she got here. Enjoy!

Kate

Friday, 23 February 2007 07:06:13 (Eastern Standard Time, UTC-05:00)  #    
# Thursday, 22 February 2007

Until now, no woman had won the Turing Award. That surprised me. Frances Allen was recognized for her work in optimization, automatic parallelization, and high performance computing. She must be used to receiving honours. According to the ACM's press release:

In 1989, Allen was the first woman to be named an IBM Fellow. In 2000, IBM created the Frances E. Allen Women in Technology Mentoring Award, naming her as its first recipient. As her Turing Award citation notes, she has been an inspirational mentor to younger researchers and a leader within the computing community. She is an Advisory Council Member of the Anita Borg Institute for Women and Technology, whose goal is to increase the participation of women in all aspects of technology. She also received the first Anita Borg Award for Technical Leadership, which was presented at Grace Hopper Celebration of Women in Computing in 2004.

She joined IBM fifty years ago. Wow, what she must have seen in those fifty years!

Kate

Thursday, 22 February 2007 22:50:12 (Eastern Standard Time, UTC-05:00)  #    
# Wednesday, 21 February 2007

I came across this list of "making the most of your time" and it struck a chord with me. I think because it's not just about productivity and crossing a lot off the to-do list, but instead thinks about what you are achieving with the time you spend. Not many productivity lists include "making a difference to the world". Something to think about...

Kate

Wednesday, 21 February 2007 22:44:02 (Eastern Standard Time, UTC-05:00)  #    
# Tuesday, 20 February 2007

The Developer Night in Canada (DNIC) User Group Tour is all set!

Our (East of Toronto) date is April 11th. Register now!

The purpose of this event is to demonstrate how the Microsoft Application Platform provides a robust and secure foundation for building data-driven applications and Web sites. Specifically, this session will examine some of the tools and technologies available for developers including Visual Studio Team System for Database Professionals and examine some of the exciting new features of ADO.NET.

Our session will feature our own alumnus, Jean-Luc David:

Jean-Luc David has written four books for Wiley Publishing (including Professional JavaScript 2nd Edition, Professional WinFX Beta, Professional Visual Studio 2005 Team System and most recently, Professional Team Foundation Server). Prior to joining Microsoft Jean-Luc had been a Microsoft MVP for three years. Jean-Luc is very passionate about the community and loves talking and interacting with developers and IT professionals. Jean-Luc lives in downtown Toronto.

See you there!

Kate

Tuesday, 20 February 2007 16:38:34 (Eastern Standard Time, UTC-05:00)  #    
# Monday, 19 February 2007

Channel 9 has discovered C++ land and just doesn't want to leave. This time it's Nikola Dudar's turn and he talks about STLCLR (which has had various other names in the past):

If you write STL code and want take advantage of the BCL while still being able to write STL code, then you're in luck. How so? Well, Nikola Dudar, program manager in the VC++ Libraries Group explains, in detail, the Orcas STLCLR library. We also dig into the evolutionary trajectory of VC++, and discuss some other interesting Orcas C++ libraries. Tune in. Lots of great stuff going on in VC++ World...

Keep 'em coming, Charles!

Kate

Monday, 19 February 2007 15:40:09 (Eastern Standard Time, UTC-05:00)  #    
# Sunday, 18 February 2007

I will be in Montreal in May to speak at DevTeach.

My talk:

It’s Vista time – is your application ready?

Windows Vista provides an extensive set of new APIs that enable improved user experiences and enhanced security, but some of these APIs are exposed through native COM and Win32 programming models. This session highlights strategies and techniques for taking advantage of these native APIs from managed code. Learn what's really involved in making your .NET application "light up on Windows Vista" with User Account Control (UAC) integration, Windows Vista User Experience features like common file dialogs, task dialogs and command links, and integrated desktop search.

DevTeach is a lot easier to get to than some of the bigger conferences, and it has a star-studded speaker list. See you there!

Kate

Sunday, 18 February 2007 15:35:55 (Eastern Standard Time, UTC-05:00)  #    
# Saturday, 17 February 2007

Imagine that you needed to go somewhere NOW and stay there for a while. Like maybe weeks or months. What would you need to take? It kinda matters why you're leaving, or maybe it doesn't. You could be fleeing a burning house like my neighbours did, or flying to a sick relative, or responding to any number of natural or family disasters. And the last thing you need at a time like that is to be running around wondering about paperwork and documents to take with you.

If you have a laptop, that's a really good start, but think about all the identity-related numbers you sometimes need to look up. For example, what if you needed to write a cheque? It doesn't happen very often these days, but should you take your chequebook with you just in case? Maybe it would be enough to have your account information with you, so you could call your branch and ask them to courier you cheques. Maybe you live in a small enough town (I do) that the bank knows who you are by your name and doesn't need the account number. What about all your credit cards, even the ones you don't use and keep for emergencies? Can you get the balance for all of those online or over the phone -- sure you can. But not all of them tell you your credit limit (why? I have no idea) so perhaps a list of cards and their limits would be handy. And coming back to that burning house, I bet your insurance policy is in it. Do you even know your agent's phone number? Why on earth would you? It's not like most of us chat with whoever sold us that policy all those years ago.

Lifehacker suggests putting this sort of thing on a "getaway drive". List your bank accounts, with the phone numbers and names of the branches and your rep or agent. List where your safety deposit boxes are. Put everyone's SIN, and maybe scan your passports, drivers licenses and so on. Scan your insurance policies, at least the most recent bill with your policy number on it. If you might end up going out the door without your credit cards, having the numbers to call to get new ones (with your account numbers and whatever other information they might ask for to confirm your identity) could save a lot of time. Think about needing to replace cards, ID, and the like. Think about needing to connect to your finances from somewhere else, maybe from someone else's computer -- you know, that doesn't have a file called passwords.txt on the desktop :-) and a Favourites list of links to all the companies you have accounts with? Put what you need on here - a Word file, a bunch of JPGs (scan stuff or just take pictures of it with your digital camera), an HTML file of links. Then encrypt the heck out of it, and put it on a little memory stick / flash drive. [If you've got lots of spare space, take a hundred or so pictures of stuff in your house -- the CD collection in the living room, a slow video pan across each bookshelf, your dishes, your closets, and so on to simplify any future insurance claims. Imagine being able to answer the question "how many books were in the house?" ] Put the drive somewhere that's always with you but not incredibly losable, or that's easy to grab on the way out of the door. Heck, make a copy and snail mail it to the family member who lives furthest from you, and ask them to hold it for you indefinitely. One less thing to worry about.

Kate

Saturday, 17 February 2007 15:26:02 (Eastern Standard Time, UTC-05:00)  #