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

  • Home
  • SEARCH
  • 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 6719505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:06:03+00:00 2026-05-26T09:06:03+00:00

In C is it undefined behaviour to call a 3rd party library function (not

  • 0

In C is it undefined behaviour to call a 3rd party library function (not provided as source code)?

By this I mean:

  • Not calls to the Standard C Library.
  • Not calls to an additional library provided by the compiler vendor.
  • Not calls to a library created by me using the C compiler.
  • Not calls to a 3rd party library that was provided as source code and where I have compiled the library myself using the C compiler.
  • Not calls to a precompiled 3rd party library that I know was compiled using exactly the same C compiler that I am using.

In other words I am interested in scenarios that rely in some way on ABI compatibility (perhaps between different C compilers, or different versions of the same C compiler, or between compilers of different languages). The C standard has nothing to say on how to achieve ABI compatibility.

I am primarily interested in C90, which states in Section 3.16:

Undefined behavior is otherwise indicated in this International Standard by the words “undefined behavior” or by the omission of any explicit definition of behavior.

It could be argued that calling a 3rd party library function is undefined behaviour because of the “omission of any explicit definition” part of the clause above.

It could also be argued that calling a 3rd party library function is not implementation defined behaviour because the library is not provided by the compiler vendor.

If calling a 3rd party library function is indeed undefined behaviour, it means that there are 2 degrees of undefined behaviour in C, and that advice to avoid all undefined behaviour is over simplistic. How do we know which types of undefined behaviour are “OK” and which types may be viewed by the compiler writer as an opportunity to do “anything” in the interests of improving benchmark results?

EDIT: I have edited the question and the title to clarify that I am excluding cases where I compile the library myself. I don’t think this changes the meaning of the question because I would argue that most 3rd party libraries are used in precompiled form.

  • 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-26T09:06:03+00:00Added an answer on May 26, 2026 at 9:06 am

    From the C standard (again:)

    5.1.1.1 Program structure
    1 A C program need not all be translated at the same time. The text of the program is kept in units called source files, (or preprocessing files) in this International Standard. A source file together with all the headers and source files included via the preprocessing directive #include is known as a preprocessing translation unit. After preprocessing, a preprocessing translation unit is called a translation unit. Previously translated translation units may be preserved individually or in libraries. The separate translation units of a program communicate by (for example) calls to functions whose identifiers have external linkage, manipulation of objects whose identifiers have external linkage, or manipulation of data files. Translation units may be separately translated and then later linked to produce an executable program.

    And AFAIK, exactly how translating/compiling and linking is done is beyond the standard, so, whether those libraries contain compiled code or not is up to the implementation.

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

Sidebar

Related Questions

The standard says that dereferencing the null pointer leads to undefined behaviour. But what
This code leads to undefined behavior: void some_func() { goto undefined; { T x
Possible Duplicates: Undefined Behavior and Sequence Points Order of function call I have found
Ok, so I know that technically this is undefined behavior, but nonetheless, I've seen
I have noticed some unexpected behaviour when using the jQuery .ready() function, whereby afterwards
Is this program well-defined, and if not, why exactly? #include <iostream> #include <new> struct
My questions aims at the behaviour of setjmp/longjmp concerning local variables. Example code: jmp_buf
This is the statement from the C++03 standard, §14.7.1p5: If the overload resolution process
Let's say I have the following code: typedef std::function<void ()> func_type; void some_func() {
In C bitwise left shift operation invokes Undefined Behaviour when the left side operand

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.