Gibraltar Industries purchased three building products companies late last year in deals that cost the Hamburg-based building products manufacturer a total of $41 million, the company said Wednesday.

The acquisitions, which took place from mid-November through late December, added a company that makes sun-protection products for homes, a business that makes components for public infrastructure construction and maintenance, and a firm that makes perforated metal products for industrial and automotive uses.

The acquisitions had a combined $55 million in sales during the last year and generated about $7 million in adjusted operating profits.

Brian J. Lipke, Gibraltar’s chairman and CEO, said the acquisitions strengthen the company’s position in the housing and public infrastructure markets, while also broadening its product lines and expanding its relationships with customers.

Gibraltar also expects to realize “meaningful” cost savings by integrating the three new businesses into its existing operations.

The company did not identify the businesses that it purchased, and a Gibraltar spokesman did not respond to a request for additional information.

At the same time, Gibraltar said that it expects to show a loss for the fourth quarter of 2012, although nowhere near as much as it did during the final quarter of 2011, on sales that were slightly weaker than company executives predicted in early November.

Gibraltar said that it expects to lose between 1 and 3 cents per share from its continuing operations during the fourth quarter, compared with a loss of 22 cents per share a year ago.

The company said that it would have been profitable during the quarter if not for one-time charges that shaved 2 to 5 cents per share from its earnings because of acquisition-related costs and expenses stemming from restructuring efforts that led to a pullout from some business activities.

Excluding those one-time charges, Gibraltar said that it would have earned between a penny and 5 cents per share during the quarter, compared with a loss of 17 cents per share, after special charges, during the fourth quarter of 2011.

Gibraltar’s sales for the fourth quarter are expected to total about $172 million, slightly less than the $174 million in revenues that it recorded the year before and that company executives said in November they expected during the latest quarter.

The company also said that it plans to refinance part of its debt by selling $210 million in new senior subordinated notes, which it would use to purchase $204 million in existing debt that carries an 8 percent interest rate.