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 6170127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:58:34+00:00 2026-05-23T22:58:34+00:00

I’m not asking about WHEN to link different programming langauges. This is quite a

  • 0

I’m not asking about WHEN to link different programming langauges.

This is quite a general question but I’m personally working on Linux.

What I want to understand is the process by which different programming languages can be
combined, I found a good article on combining C/C++/Fortran:
http://www-h.eng.cam.ac.uk/help/tpl/languages/mixinglanguages.html.

From what I understand most compilers perform two stages:

  1. Translating the language files into object files which contain machine code but still
    contain some symbols (possibly function names?)

  2. Linking the object files together, only at this stage the Linker checks that the functions
    in the object files are callable.

I think that the problem with combining different languages is name mangling which means
that the names of the functions are changed when they are turned into object code.

The questions are:

  1. Can’t you somehow discover the mangled function names beforehand and than specify them explicitly in the programming language or better off, isn’t there a software that already does that?

  2. I don’t understand completely how dynamic libraries are linked but can different languages
    interact by the same method that programs interact with dynamic libraries?

p.s The main intent is to call functions written in another language.

  • 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-23T22:58:35+00:00Added an answer on May 23, 2026 at 10:58 pm

    The issue with linking different object files together generally comes down to subroutine calling conventions. Basically, when you make a call to a routine located in another object file, your compiler will have to know what that other object file will name its routine internally, how to pass all its parameters, and what (if any) setup and cleanup code the routine will require. All this stuff is generally grouped together under the heading of calling conventions.

    Each compiler has its own calling conventions it likes to use for subroutines. Note I said “compiler”, not language. The C calling convention in Linux is different than the C calling convention on Windows.

    So when you mix languages, you need some way to tell the compiler for either the calling or the called subroutine to use the other language’s calling convention. C’s convention is a popular one to use as sort of a “lingua franca”, as just about every platform has a C compiler. However some platforms (eg: Windows) have multiple popular calling conventions.

    So now we ask the question you asked in the comments:

    Is there a common way to “tell the compiler to use the other language’s calling convention”?

    And the answer is, “No, not really”. Some languages do have defined ways of using specific other language’s calling conventions. For example, C++ allows you to to put extern "C" on declarations to tell the compiler that the declaration(s) in question use the C calling convention. Ada accomplishes the same thing with pragma Convention (X,...), where X is the convention name. C, Fortran, and Cobol are defined by the language, but anything else supported (eg: Windows’ Stdcall) is implementation defined.

    However, if you have a pair of languages whose compiler writers never thought of each other, then you have no choice but to tell both to use some third convention that they both know about (usually C’s). For example, to get standard C++ and Ada to interoperate, you’d have the server code export its routines using the C convention, and tell the client code that the routines it is calling are using the C convention.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
For some reason, after submitting a string like this Jack’s Spindle from a text
I want to count how many characters a certain string has in PHP, but
I'm looking for suggestions for debugging... If you view this site in Firefox or
I have some data like this: 1 2 3 4 5 9 2 6
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have just tried to save a simple *.rtf file with some websites and
I want use html5's new tag to play a wav file (currently only supported
I am currently running into a problem where an element is coming back from

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.