Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7691319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:35:45+00:00 2026-05-31T20:35:45+00:00

This is so frustrating! I don’t know why this is happening. I have a

  • 0

This is so frustrating! I don’t know why this is happening. I have a file called weirdDLL.c:

double five() {
    return 5.0;
}

I have another file called weirdTest.c

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char** argv) {
    double f = five();
    if (f != 5.0) {
        printf("Test failed with %f", f);
        return 1;
    }
    return 0;
}

I expect that, when compiled and linked with the DLL, the code in weirdTest will exit without error. I am compiling on 64bit Windows 7 using gcc (cygwin) with the commands:

gcc -c weirdDLL.c
gcc -shared -o weirdDLL.dll weirdDLL.o
gcc -o test weirdtest.c -L./ -l weirdDLL
./test

The output is:

Test failed with 0.000000

It seems like the DLL is getting linked up correctly because the compiler does not complain about missing function “five.” Additionally, when I put print statements in the DLL code, they show up fine. What did I do wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T20:35:46+00:00Added an answer on May 31, 2026 at 8:35 pm

    Just a wild guess:

    You don’t seem to declare a prototype for five() in weirdTest.c, this is why the compiler treats the return type of that function as int. The resulting conversion from int to double messes up your original double value.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I don't understand why this keeps happening... An hour ago I had the return
I tried endlessly now you resolve this utter frustrating situation I have been having.
this is an extremely frustrating situation. We have just upgraded to Visual Studio 2010
This has been really frustrating for me so I'll try explain what I know
One of my projects suddenly had its double-clicking behavior changed and I don't know
this is really frustrating me. this problem occurs when I have a particularly large
All, I know that there is this question already out there: jquery file upload
This is very frustrating. If I don't set the height and width of the
this is frustrating... I keep getting an error with my ftp_put: This the error:
I've been having this rather frustrating problem, and having failed so many times, I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.