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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:56:58+00:00 2026-06-13T14:56:58+00:00

On Windows, when using g++ 4.6 (mingw) and -std=c++0x and linking with a third

  • 0

On Windows, when using g++ 4.6 (mingw) and -std=c++0x and linking with a third party static library (which was provided by the vendor for use with mingw), the application works fine. When I switched to g++ 4.7.2 (mingw) so that I could use -std=c++11, the application builds fine but crashes when run. If I comment out calls to the vendor provided library then it doesn’t crash. I asked customer support of the library vendor and was told that this was not supported.

My question is, “Are there any ABI incompatibilities” when going to a newer version of the g++ compiler? Is it not backward compatible? Aren’t newer versions of the compiler supposed to work with existing and legacy 3rd party static libraries?

Note that this only happens on Windows (mingw) platform. Works fine on Linux.

I have added more info on this:

Has anyone used Chilkat’s MinGW C++ (static) libraries in a windows application whose source is compiled with g++ 4.7.2 with -std=c++11 compile option? The app crashes when Chilkat api is accessed (for e.g CkString object is instantiated). Works fine on g++ 4.6.2 (where I use std=c++0x).
On Linux with g++ 4.7.2 this program works fine. If there is ABI incompatibility when moving from 4.6.2 to 4.7.2 then it shouldn’t work on Linux also, right? Why would static library chilkat-9.3.2/lib/libchilkat.a created by vendor for use with MINGW care if the rest of the program is compiled with the latest g++ compiler — is this a MINGW specific change in ABI?

#include <windows.h>
#include <stdio.h>
#include <CkString.h>
int main(int argc, char *argv[]) {
  printf("test chilkat\n");
  CkString str1;
  printf("test done\n");
}
gdb -i=mi test_chilkat.exe
Starting program: test_chilkat.exe
[New Thread 4704.0x1a44]

Program received signal SIGSEGV, Segmentation fault.
0x00404442 in CkObject::CkObject() ()
  • 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-13T14:56:59+00:00Added an answer on June 13, 2026 at 2:56 pm

    MinGW 4.6.2 is definitely generating different code to call the CkString constructor than 4.7.2.

    Here’s the command line I used to compile your test program to the assembly code file (where ./include is the location of the Chilkat headers):

    g++ -I ./include -S -masm=intel -std=gnu++0x test.cpp
    

    Here are annotated disassemblies bookended by the two printf() calls (which GCC generates as puts() calls).

    • 4.6.2:

      call    _puts
      
      lea eax, [esp+28]           ; eax gets pointer to `str1` being constructed
      mov DWORD PTR [esp], eax    ; put the `str1` pointer on the stack
      call    __ZN8CkStringC1Ev   ; call `CkString::CkString()` ctor
      
      mov DWORD PTR [esp], OFFSET FLAT:LC1
      call    _puts
      
    • 4.7.2:

      call    _puts
      
      lea eax, [esp+28]           ; eax gets pointer to `str1` being constructed
      mov ecx, eax                ; ecx gets `str1` "this" pointer
      LEHB0:
      call    __ZN8CkStringC1Ev   ; call `CkString::CkString()` ctor
      
      mov DWORD PTR [esp], OFFSET FLAT:LC1
      call    _puts
      

    As you can see, 4.6.2 passes the “this” pointer to the constructor on the stack (which is what the Chilkat library expects). 4.7.2 passes the “this” pointer in ecx.

    It looks like starting with 4.7.0. MinGW changed the C++ class-member calling convention to __thiscall. See http://mingw-users.1079350.n2.nabble.com/MinGW-GCC-4-7-0-released-td7578133.html

    It looks like you can override that default using the -mabi=sysv option, which makes your test program work for me:

    C:\temp>g++ --version
    g++ (GCC) 4.7.2
    ...
    
    C:\temp>g++ -mabi=sysv -I ./include -g -Wl,--enable-auto-import test.cpp -o test.exe libchilkat-9.3.2.a
    
    C:\temp>test
    test chilkat
    test done
    

    However, you’ll probably be buying yourself more trouble with other libraries in more complex programs – for example, you’ll almost certainly need to rebuild libstdc++.a at the very least.

    I’d press the Chilkat developer for a 4.7.x library a bit more…

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

Sidebar

Related Questions

I'm trying to use the JsonCpp library. I'm on Windows, using MinGW and CodeBlocks.
Is there possibility to compile windows service using only mingw c++ compiler and library?
I use GNUStep to compile Objective-C on Windows 7 using GCC and MinGW. I'd
I am using C++ from Mingw, which is the windows version of GNC C++.
Using Qt Creator 2.4.1 (Windows/mingw), I'm trying to compile my project dynamically linking with
I am using MinGW compiler on Windows to compile my C++ application with sockets.
I've built yamlcpp static (libyaml-cpp.a) library using Qt's mingw compiler. Now I want to
I am using windows emacs with specifications below. GNU Emacs 23.0.91.1 (i386-mingw-nt5.1.2600) of 2009-02-26
I'm using MinGw on Windows 7. The following simple program compiles fine, but the
I am using MinGW which does not have full functionality. eg. It has no

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.