ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Segmentation fault while running chartdirector 5.1 64 bit samples under Mingw/TDM 64 bit running under Windows 8 64 bit
Posted by user3924882 on Nov-27-2014 15:01
I compiled sample High-Low-Open-Close Chart code given in the documentation.
It compiled fine, no issues.

Compiler: TDM GCC 4.8.1 64 bit
OS: Windows 8 64 bit
Editor: Code blocks 13.12

Sample application crashed at runtime. I debugged the code using GDB 64 bit.
I have copied chartdir51.dll in the sample application \\bin directory. No matter how I
compile it & link it, statically linked or runtime linked, app crashes.
Not sure, what is the problem here.

Is ChartDirector library supported with Mingw/TDM 64 bit?

Here's Debugger trace:
Debugger name and version: GNU gdb (GDB) 7.6.1
Child process PID: 2436
Program received signal SIGSEGV, Segmentation fault.
In CXYChart_create () ()
#1  0x000000000041f943 in XYChart::XYChart (this=0x953d40, width=600, height=350,
bgColor=-65536, edgeColor=-16777216, raisedEffect=0) at
D:/chartdir_cpp_win64/include/chartdir.h:2150
D:\\chartdir_cpp_win64\\include\\chartdir.h:2150:92969:beg:0x41f943
At D:\\chartdir_cpp_win64\\include\\chartdir.h:2150
#1  0x000000000041f943 in XYChart::XYChart (this=0x953d40, width=600, height=350,
bgColor=-65536, edgeColor=-16777216, raisedEffect=0) at
D:/chartdir_cpp_win64/include/chartdir.h:2150
D:\\chartdir_cpp_win64\\include\\chartdir.h:2150:92969:beg:0x41f943
Debugger finished with status 0

  Re: Segmentation fault while running chartdirector 5.1 64 bit samples under Mingw/TDM 64 bit running under Windows 8 64 bit
Posted by user3924882 on Nov-27-2014 16:07
Same application works fine when compiled under MS VC 2013.

  Re: Segmentation fault while running chartdirector 5.1 64 bit samples under Mingw/TDM 64 bit running under Windows 8 64 bit
Posted by Peter Kwan on Nov-27-2014 23:47
Hi user3924882,

I will download Mingw/TDM GCC 4.8.1 to test it. I will let you know of the result.

Regards
Peter Kwan

  Re: Segmentation fault while running chartdirector 5.1 64 bit samples under Mingw/TDM 64 bit running under Windows 8 64 bit
Posted by user3924882 on Dec-01-2014 20:23
Hello Peter,

Did you get a chance to check the sample program under TDM GCC?

  Re: Segmentation fault while running chartdirector 5.1 64 bit samples under Mingw/TDM 64 bit running under Windows 8 64 bit
Posted by Peter Kwan on Dec-01-2014 23:13
Hi user3924882,

Sorry for forgetting to update this thread.

I have performed detail testing and can reproduce the same problem in both Windows 8 and
Windows 7. We suspect there is some incompatibilities in TDM gcc and Microsoft C++
regarding how to initialize C++ DLLs. It seems certain internal C++ structures and tables are
not initialized when loading the C++ DLL generated by Microsoft compilers and linkers.

So at this stage, we have to admit that the TDM gcc 64-bit compiler is not supported.

Regards
Peter Kwan

  Re: Segmentation fault while running chartdirector 5.1 64 bit samples under Mingw/TDM 64 bit running under Windows 8 64 bit
Posted by Herve on May-07-2016 07:55
Hi,

Just to let you know that we had several time this issue in the past and still today with TDM gcc and ChartDirector on Windows 64 environment. We finally succeed to have everything working.
You have to generate a chartdir51.a file that you will be used for the link instead of the charter.lib

Please find here the steps to generate the .a:
$ gendef.exe chartdir51.dll
* [chartdir51.dll] Found PE+ image
$ ls -ltr
total 3777
-rw-r--r-- 1 vagrant None  195918 Jun 29  2013 chartdir51.lib
-rw-r--r-- 1 vagrant None 3649536 Jun 29  2013 chartdir51.dll
-rwxr-xr-x 1 vagrant None   19628 May  6 06:51 chartdir51.def
vagrant@Win764 ~/tmp/other_libraries/chartdirector/lib/win64
$ dlltool -d chartdir51.def -l libchartdir51.a
vagrant@Win764 ~/tmp/other_libraries/chartdirector/lib/win64
$ ls -ltr
total 4396
-rw-r--r-- 1 vagrant None  195918 Jun 29  2013 chartdir51.lib
-rw-r--r-- 1 vagrant None 3649536 Jun 29  2013 chartdir51.dll
-rwxr-xr-x 1 vagrant None   19628 May  6 06:51 chartdir51.def
-rwxr-xr-x 1 vagrant None  632660 May  6 06:53 libchartdir51.a

$ rm -rf chartdir51.lib chartdir51.def

Hervé

  Re: Segmentation fault while running chartdirector 5.1 64 bit samples under Mingw/TDM 64 bit running under Windows 8 64 bit
Posted by Peter Kwan on May-10-2016 02:20
Hi Herve,

Thanks a lot for your very useful feedback. We appreciate very much for sharing this useful solution.

Regards
Peter Kwan

  Re: Segmentation fault while running chartdirector 5.1 64 bit samples under Mingw/TDM 64 bit running under Windows 8 64 bit
Posted by Dan Butterfield on Aug-11-2016 05:29
Hi,

I am currently experiencing exactly the same problem as the OP with a very similar setup:

GCC 5.3.0 64 bit
Windows 10 64 bit
Code::Blocks 13.12

I can compile the ChartDirector demo programs just fine, but the executable crashes as soon as a chart object is created.

I have tried Hervé's solution but unfortunately it didn't work for me - the commands completed successfully but when I link with the new library, compilation fails like this:

In function `BaseChart::~BaseChart()':
...includechartdir.h 1020 undefined reference to `CBaseChart_destroy'

Any suggestions?

Thanks,
Dan

  Re: Segmentation fault while running chartdirector 5.1 64 bit samples under Mingw/TDM 64 bit running under Windows 8 64 bit
Posted by Dan Butterfield on Aug-11-2016 07:30
Soon after posting, I fixed it.

It turns out that I was using 32-bit versions of gendef.exe and dlltool.exe - as soon as found recent, 64-bit binaries, everything worked as expected.

Thank you Hervé!