Hi all,
I am pretty new to vb.net and as such facing a pretty simple.

I have an application which is finally going to call a function defined in a dll.
The function declares a variable of type unsigned long

int funct(unsigned long lvar);

The size of unsigned long on my machine in 4 bytes.

Now in vb.net (I am using VS 2005 express) app, I have declared a variable(lvar) of type int32.

In the vb.net app, I am giving the variable (lvar) a value equal to "He443ea12"
(decimal value = 3829656082 )

This value is greater than the max value of the type int32.( max value = 2,147,483,647)

After this I am calling the function funct(lvar), defined in the dll, in the usual way.

Everything is working fine with the function doing it's intended purpose.

However, I read in some article that vb.net raises an exception as soon as it detects the
integer getting overflowed. In my app, integer overflow is clearly taking place ,but still I
am not getting any exception from my app.

Can somebody please point out where I am wrong?

PS I cannot use uint32 in my app so as to make the app CLS compliant. Also I cannot use Int64 as
the variable in my dll is of 4 bytes and hence it's usage is giving me the stack
imbalance problem.

9 Years
Discussion Span
Last Post by adv

As a side note, this is how I am giving a large value to the varible in the vb.net app

dim lvar as int32

Dim sVar As String = "9705a27d"
lvar = Int32.Parse(sVar.Trim(), Globalization.NumberStyles.HexNumber)


This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.