Visual C: Obtaining __int64 value from a DLL

K

kgpsoftware

Hi folks,

I have a DLL which contains functions that return __int64 values, but I
can't get Visual C to read the return value correctly. I am using the
2003 version.

Here is the declare:

__int64 __stdcall TEST(void);

...and the calling code:

__int64 ret;
ret = TEST();

In all cases, ret is zero. Is there a special compiler switch I need to
use, or is this not supported? Could the problem lie in the .lib
header?

Thanks for any assistance.
 
F

Flash Gordon

Hi folks,

I have a DLL which contains functions that return __int64 values, but I
can't get Visual C to read the return value correctly. I am using the
2003 version.

Here is the declare:

__int64 __stdcall TEST(void);

__int64 and __stdcall are not part of standard C and therefore off topic
here (we only deal with standard C not MS or POSIX or any other
extensions of 3rd party libraries).
..and the calling code:

__int64 ret;
ret = TEST();

In all cases, ret is zero. Is there a special compiler switch I need to
use, or is this not supported? Could the problem lie in the .lib
header?

It would be easier to answer your question if you had provided a
complete compilable example showing your problem. As it is, the problem
could be on any of the 9237834 lines of code you have not shown us. My
guess is line 42 of forgotten_stuff.h

Actually, a real possibility is that you don't have a declaration for
TEST in scope when you call it. Without a declaration the compiler is
required to assume TEST returns an int which is not the case here (MSVC
only supports C90 not C99, so C99 rules don't apply).

If that does not help you go to one of the microsoft groups and post a
small *complete* example showing your problem. Don't bring the
non-standard code here.
 
V

Vladimir S. Oka

Hi folks,

I have a DLL which contains functions that return __int64 values, but
I can't get Visual C to read the return value correctly. I am using
the 2003 version.

You should really ask this in a M$ Windows oriented group. It's
off-topic here (only ISO Standard C is on-topic).
Here is the declare:

__int64 __stdcall TEST(void);

..and the calling code:

__int64 ret;
ret = TEST();

In all cases, ret is zero. Is there a special compiler switch I need
to use, or is this not supported? Could the problem lie in the .lib
header?

Have you considered the possibility that 0 is the correct result?
Nothing in your post indicates that `TEST` does not terminate with a
`return 0;` statement. In other words, even if your question were on
topic, you did not provide enough information for anyone to help you.
 
K

kgpsoftware

If that does not help you go to one of the microsoft groups and post a
small *complete* example showing your problem. Don't bring the
non-standard code here.

Ok, will do. Sorry for being off topic.
 
R

Rod Pemberton

Hi folks,

I have a DLL which contains functions that return __int64 values, but I
can't get Visual C to read the return value correctly. I am using the
2003 version.

Here is the declare:

__int64 __stdcall TEST(void);

..and the calling code:

__int64 ret;
ret = TEST();

An '__int64' is just a 'long long'. It appears correct to me. Perhaps
connect to www.openwatcom.org and subscribe to openwatcom.users.c_cpp. The
OW compiler supports most MS calling conventions.


Rod Pemberton
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,830
Latest member
ZADIva7383

Latest Threads

Top