When the going gets tough, the tough get together.

That, at least, is the case of “Song for a Raggy Boy,” a multi-multi-lateral co-production closed Monday at Cannes.

Its piecemeal, patchwork financing could well be one recipe for these coin-challenged times.

“We’re delighted to have been able to pull together such diverse companies as Zentropa and Lolafilms and a U.K. financial institution without compromising the integrity of this Irish drama,” says Subotica Entertainment’s Dominic Wright, one of the pic’s producers.

The $4 million “Song” turns on an Irish man who returns to Ireland from the Spanish Civil War, where his wife and best friend are killed. He begins to teach at a school and discovers the same repression and tyranny he fought against in the Civil War.

Pic’s financing was put together ingeniously by Wright and Tristan Orpen-Lynch at Subotica, whose last production was the Dan Aykroyd-starrer “On the Nose.”

For starters, the Irish story allowed Subotica, the pic’s producer, to tap tax-driven Section 481 coin from the Irish Film Board, which invests in projects if two-thirds of a production takes place in Ireland.

Subotica’s Lucky Shamrock distribution shingle put up an advance against Irish rights.

Next, Subotica brought in Denmark’s cosmopolitan Zentropa as a co-producer. Zentropa committed 20% of budget, taking a Scandinavia pre-sale. It will also oversee post-production. Zentropa was able to access money from the Danish Film Institute.

Subsequently, Spain’s Lola took further co-production equity — 10% — against all Spanish rights and as an advance on international with Lolafilms Intl. signing on to handle overseas sales out of its London and Madrid offices, a split operation that gives it an unusual double international presence.

The three-way European co-production structure opened the door for a Council of Europe Eurimages loan under the European Co-Production Treaty.

Last but not least, with Lolafilms Intl. a bankable sales agent, Heather Mansfield — who heads up risk assessment on behalf of Lee Beasley’s film division at the Royal Bank of Scotland — was able to provide 20% gap financing.

“Song” also tapped U.K. sale and leaseback finance.

And that was that.

“At the moment, distributors and financial institutions all need to spread risk as much as possible because it’s difficult to access funding,” says Will Machin, Lolafilms’ co-prexy of international sales.

“This kind of deal, where nobody is overexposed, is perfect,” he adds.

Toplining Aidan Quinn (“Legends of the Fall”) and Iain Glen (“Lara Croft: Tomb Raider”), and helmed by Aisling Walsh (“Joyriders”), pic shoots entirely on location in Ireland in July and August.