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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:04:36+00:00 2026-06-13T05:04:36+00:00

I am curious about being able to use the most primitive ever DLL-library compiled

  • 0

I am curious about being able to use the most primitive ever DLL-library compiled in Windows, in Linux-compiled C++ code. Let’s assume that library in question is not the monstrous proprietary something from Windows core;

…just one with phony API like (here are both header and implementation):

// MathFuncsDll.h

namespace MathFuncs
{
    class MyMathFuncs
    {
    public:
        // Returns a + b
        static __declspec(dllexport) double Add(double a, double b);

        // Returns a - b
        static __declspec(dllexport) double Subtract(double a, double b);
    };
}


// MathFuncsDll.cpp

#include "MathFuncsDll.h"

using namespace std;

namespace MathFuncs
{
    double MyMathFuncs::Add(double a, double b)
    {
        return a + b;
    }

    double MyMathFuncs::Subtract(double a, double b)
    {
        return a - b;
    }
}

This library would have no dependencies other than <iostream>, would it?

Linux-compiled .cpp would contain the following:

// MyExecRefsDll.cpp
// compile with: /EHsc /link MathFuncsDll.lib

#include <iostream>

#include "MathFuncsDll.h"

using namespace std;

int main()
{
    double a = 7.4;
    int b = 99;

    cout << "a + b = " <<
        MathFuncs::MyMathFuncs::Add(a, b) << endl;
    cout << "a - b = " <<
        MathFuncs::MyMathFuncs::Subtract(a, b) << endl;

    return 0;
}

Samples were taken from amazing MSDN tutorial.

So, to make my question clear: what stops linux compiler and linking tools from using dependenceless .dll library MathDuncsDll just like another .so? Maybe, another call syntax? Or maybe the whole linking process is different? (I’d like to hear specifics, not just vague “these OS’es are fundamentionally different” and “it is impossible to use something from one platform on another”) How much effort will these differences require to be overcome (I assume we’re not using Wine)?

Thank you very much in advance!

  • 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-06-13T05:04:37+00:00Added an answer on June 13, 2026 at 5:04 am

    Incompatible Application Binary Interface is what restricts programs built with one toolchain to not work at the binary level with those compiled with other toolchains.

    For example, on Windows in C++, the exception propagation follows the Set Jump/ Long Jump model while in Linux its Dwarf 2. If you have ever used MinGW as your toolchain on Windows, the TDM-GCC MinGW distribution allows you to choose between the two.

    If you want to use any cross-platform project, you would need to build it using a toolchain with which you have been building your rest of the programs, otherwise they cannot work in tandem.

    The linked SO answer contains much more details about this.

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

Sidebar

Related Questions

Being curious about how maven works exactly, I've checked out its source codes. Astonishingly,
I'm curious about the possibility of having a .NET class library that provides a
Being obsessed with neatness in Javascript lately, I was curious about whether there is
I'm curious about the technical reason for cin.getline and the global getline function being
Curious about running multiple xvfb displays: I have between 10-50 instances of a script
I'm curious about the correct way to architect an application that consists of the
I am curious about git add action, so I do some test. create a
I am a bit curious about how this works - if I have 5
I'm curious about the underlying implementation of static variables within a function. If I
I'm curious about what be the best way to model this for optimized performance...

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.