Detecting overflow with C18
There may be tricks regarding the STATUS register but the following generic (untested) code is something I thought of to check the number of bits required to represent each input by doing repeated right bit shift operations until the value is empty. 

Then by adding the two results together you should be able to work out if the output will overflow 32 bits. 

unsigned long a = 123456;
unsigned long b = 789123;

int calc_bit_size(unsigned long v)
{
    int bit_count = 0;
    while (v &gt; 0)
    {
        bit_count++;
        v &gt;&gt;= 1;
    }
    return bit_count;
}

if (calc_bit_size(a) + calc_bit_size(b) &gt; 32)
   printf("Overflow!")
else
   printf("%lu", a * b);