473,324 Members | 2,002 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Visual C: Obtaining __int64 value from a DLL

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.

Mar 13 '06 #1
4 2130
kg*********@gmail.com wrote:
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.
--
Flash Gordon, living in interesting times.
Web site - http://home.flash-gordon.me.uk/
comp.lang.c posting guidelines and intro:
http://clc-wiki.net/wiki/Intro_to_clc
Mar 13 '06 #2
On Monday 13 March 2006 16:47, kg*********@gmail.com opined (in
<11**********************@i39g2000cwa.googlegroups .com>):
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.

--
BR, Vladimir

Q: What's the difference between USL and the Titanic?
A: The Titanic had a band.

Mar 13 '06 #3
>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.

Mar 13 '06 #4

<kg*********@gmail.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
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
Mar 13 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

140
by: Oliver Brausch | last post by:
Hello, have you ever heard about this MS-visual c compiler bug? look at the small prog: static int x=0; int bit32() { return ++x; }
1
by: Jesse Hose | last post by:
I get odd behavior in the debugger with the following code. The output of the program itself is correct, but when I add the g_bad_int64_max and g_bad_int64_min to the watch window they show values...
8
by: Jayesh | last post by:
Hi, How is a double value stored in 8 bytes ? Or what is the format ? How is it different from __int64 ? How is __int64 stored in 8 bytes. Please do reply. regards, Jayesh
8
by: hurry | last post by:
hi, I am writing a c program in VC++ 6. I have 2 files with 3 functions. file-1 having two functions "a" and "c" file-2 having a single function "b" with function "a" as main() , "a"...
4
by: Kio | last post by:
Hi, For example: 1 __int64 fib4(__int64 n) 2 { 3 if ((n==1) || (n==2)) return 1; 4 else return (fib(n-1)+fib(n-2)); 5 }
5
by: Jeff Bean | last post by:
I need to compute a 64 bit file offset which will get passed to the _lseeki64 function. The inputs to the offset calculation are all unsigned shorts or unsigned longs. For example: unsigned...
6
by: andrey.vul | last post by:
The error is LNK2001: unresolved external symbol "protected: static bool solver<typename, typename, int, int, int, int, int>::solution" (<vc++ mangled name>) Code (sudoku.cpp): // Sudoku.cpp :...
21
by: Angus | last post by:
I need to convert a double to a 64 bit integer. I am using __int64 but could of course use a more portable type. To perform the correct casts: double d = 3.3; __int64 i64; i64 =...
29
by: Kenzogio | last post by:
Hi, I have a struct "allmsg" and him member : unsigned char card_number; //16 allmsg.card_number
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.