Visual C: Obtaining __int64 value from a DLL

Discussion in 'C Programming' started by kgpsoftware@gmail.com, Mar 13, 2006.

  1. Guest

    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, 2006
    #1
    1. Advertisements

  2. Flash Gordon Guest

    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
     
    Flash Gordon, Mar 13, 2006
    #2
    1. Advertisements

  3. On Monday 13 March 2006 16:47, opined (in
    <>):

    > 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.
     
    Vladimir S. Oka, Mar 13, 2006
    #3
  4. Guest

    >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, 2006
    #4
  5. <> wrote in message
    news:...
    > 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
     
    Rod Pemberton, Mar 13, 2006
    #5
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. david
    Replies:
    7
    Views:
    11,972
    Ricardo Dominguez
    Oct 10, 2012
  2. John Tsiombikas (Nuclear / the Lab)

    Re: Different results if compared as double or __int64?

    John Tsiombikas (Nuclear / the Lab), Jun 30, 2003, in forum: C++
    Replies:
    1
    Views:
    458
    Victor Bazarov
    Jun 30, 2003
  3. Vivi
    Replies:
    2
    Views:
    6,182
    ES Kim
    Aug 25, 2003
  4. Tim Clacy

    __int64 vs. long long

    Tim Clacy, Nov 10, 2003, in forum: C++
    Replies:
    8
    Views:
    915
    Rolf Magnus
    Nov 10, 2003
  5. JR
    Replies:
    3
    Views:
    433
    Xenos
    Feb 5, 2004
Loading...

Share This Page