I am building a C++ application on Windows using Interix and need to link in three object files to supply a third-party licensing module's functionality. The third party has supplied the object files as built by Visual Studio. Is there anyway to convert the files for use with GCC? For example, perhaps if I change the name mangling from Visual Studio style to GCC style that would be sufficient, or are there other differences between the two object file formats?
相关问题
- Sorting 3 numbers without branching [closed]
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- How to know full paths to DLL's from .csproj f
- Importing NuGet references through a local project
相关文章
- How to show location of errors, references to memb
- Class layout in C++: Why are members sometimes ord
- How to mock methods return object with deleted cop
- Which is the best way to multiply a large and spar
- How to track MongoDB requests from a console appli
- C++ default constructor does not initialize pointe
- Selecting only the first few characters in a strin
- What exactly do pointers store? (C++)
In addition to the possible symbol differences between VC++ and GCC/G++, what's you are trying to do may be impossible due to Windows API issue.
Programs that built from Interix GCC can only work with Interix, and since Interix is a separated subsystem in parallel of the Windows subsystem (or say Win32 subsystem), you can't call any Windows API (ex. from kernel32.dll) from Interix programs.
If that licensing object file contain any Windows API calls, linking will not be possible.
Windows does not have a standardized C++ ABI (Application Binary Interface). It does have a C ABI, though. This is the ABI used for instance by
Kernel32.DLL
, so all Windows programming environments understand it. Many can also produce such DLLs.In this case, the C++ .obj files have to be linked by the Visual Studio linker. That linker is definitely capable of creating DLL files. You'll have to write
extern "C"
functions to wrap the licensing functionality. Add__declspec(dllexport)
to indicate that those functions are exported from the DLL (on Windows, functions by default are private to a DLL).In a header, declare those same functions as
__declspec(dllimport)
. GCC understands that as well. Then link against the newly produced DLL, which will resolve thedllimport
'ed symbols.