Page 1 of 2

Having TDGIPlus Within a DLL Causes Fault in XE4

Posted: Sat Jun 08, 2013 5:17 pm
by 16466189
My processing uses run-time TeeChart components in a DLL. It appears that my processing requires the use of TGDIPlus (#include <VclTee.TeeGDIPlus.hpp>) to complete it processing. The reason I have determined that the processing needs this is that it is not possible to delete the include. If I delete it, the processing just puts it back into the include list.

The compiling and linking is successful without any errors. When I start the application, the DLL and associated TeeChart DLLs are loaded. If I try to do something like "chart = new TChart (Application);" in the DLL, the processing faults with an access error (write of address 0x00000000). The fault occurs in TObject::InitInstance from a call from Teegdiplus::TGDIPlusCanvas.

It should be noted that if the DLL does not contain any reference (either directly or indirectly) to TGDIPlus, the "chart = new TChart (Application);" processing will work correctly. Within my DLL processing, the TGDIPlus is indirectly included as part of the TeeChart requirements based on my usage and context. I have no control over this include.

I have created a test case and included it. The test case consists of two projects. The first is the application that makes the call within the second project (DLL). The application is merely a button that once clicked will make the call to the DLL. The DLL consists of two items. The first is a shell form that will force the inclusion of <VclTee.TeeGDIPlus.hpp>. Nothing in this form is used directly. The second item is a small class that is used by the application. The class will do a "chart = new TChart (Application);" when the apllication button is clicked. This statement is the one that faults.

Since I cannot include code in the test case (file is too big), you will have to build the object files yourself. You should build Project2 first as it creates a .lib file that is needed in Project1.

I should add that I have not found any way around this problem. I am currently at a standstill and this problem prevents me from using TeeChart. This means that I cannot currently support my released application.

Please advise.

Re: Having TDGIPlus Within a DLL Causes Fault in XE4

Posted: Mon Jun 10, 2013 9:36 am
by yeray
Hi,

Are you using TeeChart v2013.08.130521 for XE4?
Your application seems to work fine for us here in two different machines with RAD Studio XE4. I see here you are using C++Builder XE4, so the only difference I see (waiting for your confirmation on the TeeChart version) would be the presence of the Delphi personality.

Re: Having TDGIPlus Within a DLL Causes Fault in XE4

Posted: Mon Jun 10, 2013 2:26 pm
by 16466189
I am using Build 2013.08.130521 with only the C++ personality. I did a clean install of XE4 C++ Builder and then installed the latest TeeChart (130521). When I got the error, I worked on a test case. The configuration did not change during that time.

Since my last post, I was able to move back to the 2013.08.130430 BETA release (I copied files and changed directories), and with these old files all is working correctly. There is definitely a difference in the two sets of files.

One other thing to note. The XE4 C++ Builder release behaves differently than XE2. I have found that if I include the TEExxxPATH defines in the project paths, the debugger will use the files in the system location (SysWOW64 in my case). If I do not include the defines in the project, the debugger will use the files from the Delphi18.win32 directory in the installed location. The projects I supplied do not contain the defines so they are going to use the files in the installed location.

Re: Having TDGIPlus Within a DLL Causes Fault in XE4

Posted: Tue Jun 11, 2013 4:16 pm
by 16466189
Since you could not duplicate the problem, I decided to do a little more investigation.

What I have found out is that the fault only occurs if I run the application from the Debugger in the IDE. (In development, I rarely run outside of the IDE as it is suppose to be the same). If I create a set of run files and execute the application outside of the IDE, all works correctly with the latest build. I have run this stand alone test case on XP 32bit, Windows 7 64bit, and Windows 8 64bit, and all executed correctly.

As I said before, I did a clean install of XE4 (C++ Builder) and then did a clean install of TeeChart, so all IDE settings were at their defaults based on the XE4 and TeeChart installation processing. Obviously, the Debugger is loading something different or in a different order.

Also note that I made an incorrect statement. The Debugger will use the files from SysWOW64 (in this case) regardless of the settings.

Re: Having TDGIPlus Within a DLL Causes Fault in XE4

Posted: Wed Jun 12, 2013 11:29 am
by yeray
Hello,

It also sounds strange to me. I guess you already did, but let me ask if you've compared the debug and release paths at project options.
I'd also suggest you to do the tests with a new simple project; this is the easiest way to be sure no wrong references are hardcoded in the project files.

Re: Having TDGIPlus Within a DLL Causes Fault in XE4

Posted: Wed Jun 12, 2013 3:33 pm
by 16466189
C++ does not have any debug path options like you have in Delphi. We have only an Include and Library path choice. The TeeChart options for these paths was provided by your install and were the expected names pointing to the installed software. (These are the same values as the TEExxxPATH values). These paths are not used to run the software as the files installed in SysWOW64 are used during the execution from within the IDE. I verifed that the SysWOW64 files are being used by substituting the BETA release files (that work) with the lastest build files (that don't work).

As for the projects. The test case I sent you had an exe and dll project. Both of these projects I created new within the XE4 install. I do not have any TeeChart paths in the projects as they are no longer needed for the include and library processing.

I have tried to keep the IDE as clean as possible for my processing. As I said before, the XE4 C++ was a clean install followed by a clean install of TeeChart (latest build). This doesn't get any cleaner as it is the only version of Embarcadero that is installed on this machine.

Re: Having TDGIPlus Within a DLL Causes Fault in XE4

Posted: Thu Jun 13, 2013 11:31 am
by narcis
Hello,

Thanks for your feedback.
rgsolutions wrote:C++ does not have any debug path options like you have in Delphi.
Actually those options are only available at project level at Project -> Options -> C++ Compiler -> Directories and Conditionals -> Target. Here you can change between debug and release configurations. Getting different behaviour with different modes makes us think there might be some difference here. Can you please check this?

Thanks in advance.

Re: Having TDGIPlus Within a DLL Causes Fault in XE4

Posted: Thu Jun 13, 2013 2:25 pm
by 16466189
I looked at the area you suggested. There is no debugging information there. The options available are:

Conditional defines
Include file search path
Object file output directory
Undefine any previous definition of name
Windows header files version defines

I have been using C++ for a very long time (Borland, CodeGear, etc.) and to my knowledge, there has never been the ability to designate the debug location.

Please remember that if I change the files in the SysWOW64 back to the BETA version of TeeChart (for XE4), all works. There is a difference in the files between the two builds.

Re: Having TDGIPlus Within a DLL Causes Fault in XE4

Posted: Fri Jun 14, 2013 5:35 pm
by 16466189
I have some more information for you regarding this issue. Today I downloaded and installed update 1 for XE4. When I started C++ Builder, I got two errors when it was loading TeeChart. Both problems were due to the fact that something was declared in two different dlls.

The first error was in FMX which I do not use, so I did not pay as close attention. The second error occurred in the Tee files so I payed attention. It said something about TGDIPlus being declared in two DLLs and could not load it and do you want to load it in the future. I said no. I think the two DLLs was Tee918 and TeePro918, but one of them could have been TeeUI918. I am not really sure about the names and I probably should have paid more attention.

I moved the TeeChart system files around to see if the latest version of TeeChart still fails, and it does. The BETA version of system files still works. I think that the IDE identified TGDIPlus as an issue most likely coincides with my problem when I run from within the IDE. Hope this information is useful.

Re: Having TDGIPlus Within a DLL Causes Fault in XE4

Posted: Tue Jun 18, 2013 12:11 pm
by yeray
Hello,
rgsolutions wrote:I have some more information for you regarding this issue. Today I downloaded and installed update 1 for XE4. When I started C++ Builder, I got two errors when it was loading TeeChart. Both problems were due to the fact that something was declared in two different dlls.

The first error was in FMX which I do not use, so I did not pay as close attention. The second error occurred in the Tee files so I payed attention. It said something about TGDIPlus being declared in two DLLs and could not load it and do you want to load it in the future. I said no. I think the two DLLs was Tee918 and TeePro918, but one of them could have been TeeUI918. I am not really sure about the names and I probably should have paid more attention.
This sounds as a quite frequent problem customers find: Unit * was compiled with a different version of *
This use to indicate there's a older version still being loaded (ie, the Standard version shipped with the IDE, tee*0), or there's a 3rd party component being loaded that uses another version of TeeChart.
Please, check the list of packages that are being loaded, with no project opened.
rgsolutions wrote:I moved the TeeChart system files around to see if the latest version of TeeChart still fails, and it does. The BETA version of system files still works. I think that the IDE identified TGDIPlus as an issue most likely coincides with my problem when I run from within the IDE. Hope this information is useful.
I use TeeInstall to swap between TeeChart versions to use in an IDE, I check the paths and the list of packages each time, and I try if everything works fine each time with a new simple application, dropping a chart into the form.

Re: Having TDGIPlus Within a DLL Causes Fault in XE4

Posted: Tue Jun 18, 2013 4:01 pm
by 16466189
First of all, the error that I saw had nothing to do with the version. It said that TGDIPlus was present in two different files. This conflict was good enough that Embarcadero thought it was necessary to display a message regarding the conflict.

Second of all, I sent you a test case that duplicated the problem that I was having. It is a really solid problem, and the test case was a brand new pair of very simple projects that were created on a clean install of XE4 and the latest TeeChart. The projects include a DLL and an EXE that are dynamically linked. In this test case, no chart is dropped on the form (nor ever has been). Rather, one is created dynamically in the processing. It is during this dynamic creation of the TChart that the problem occurs, so it is necessary to actually run the test case, not just drop a component onto a form. (I should also note that dropping a component on the form may actually change the dynamics of the processing and mask the problem). You apparently compiled and ran my test case and you said it worked okay for you. My question is this: Did you run my test case from outside the IDE or from within the IDE? If you ran it outside the IDE, it will work. It only fails if you run it from within the IDE like I said in an earlier posting.

I can understand if you ran it outside the IDE as I was not specific at the time. However, when you said you could not duplicate the problem, I started to experiment and found that it only fails if the run is done from the IDE. When I found out this information, I communicated it to you. I expected that with this new information, that if you had not done so, that you would retry the test case in conditions that I provided (from within the IDE). So here is the final questions: Did you compile and run my test case from within the IDE and if it did run, did you then compile and run it with only a C++ personality installed?

Re: Having TDGIPlus Within a DLL Causes Fault in XE4

Posted: Wed Jun 19, 2013 12:18 pm
by yeray
Hello,

I've just prepared a new and clean environment. I only installed Windows 7 x64 (Ultimate N) with Service Pack 1, C++Builder XE4 with Update1 and TeeChart Pro v2013.08 (final binary, not beta), everything with the default settings. I've only manipulated the order of the paths, since the TeeChart installer has put the correct paths, but I moved them to the top.
Then, I tried a new C++Builder VCL application. Dropped a TChart into the form. Everything builds and runs fine.
Then, I tried your testing application from the first post. Built Project2 ok. Built Project1 ok. Run Project1 without problems from the IDE, with F9. Nothing is shown when I press Button1, but I've put a breakpoint at Unit2.cpp, line 32, and I see how the process passes through the conflictive line without any error:

Code: Select all

chart = new TChart (Application);
This test would confirm there is something else causing some kind of conflict. The only ideas I have are to check the mentioned above: paths and list of components.

Re: Having TDGIPlus Within a DLL Causes Fault in XE4

Posted: Wed Jun 19, 2013 5:55 pm
by 16466189
Thanks for the input. The only difference that I can see is that you are running Windows 7 and I am running Windows 8 (Pro). While this may not seem like much, I am finding that the Embarcadero IDE may have some issues with Windows 8 (64bit). It is possible that it is a Windows 8 issue along with the changes you made between Beta and the current build.

However, I would like to table this discussion. I have noticed that there are other reported problems with GDIPlus and C++, and you have indicated that you will be addressing them. It is possible that you may fix my problem as well, so I will wait until the next update comes out (or the one with the GDIPlus fixes in them). Once I have this update I will retry my test case. If it is still a problem, I will open a new thread and report the issue, hopefully with detailed information to duplicate it. In the meantime, I have the BETA release installed and it is working just fine for what I need. I can wait.

Thanks again for the attention you paid to my issue.

Re: Having TDGIPlus Within a DLL Causes Fault in XE4

Posted: Thu Jun 27, 2013 11:15 am
by yeray
Hello again,

I've prepared another fresh environment to discard Win8. I installed Windows 8 Pr x64 (N) and C++Builder XE4 with Update1. I've found no problems with TeeChart Pro v2013.08 (final, not beta), both binary and source code versions; and I've tried all the project types and platforms available. I've also tried your testing application+dll and I see no error.

So that's good to see TeeChart looks stable in a new fresh environment, but at the same time, not being able to reproduce the problems you and other customers are reporting doesn't give us any new clue to what could be causing the problem you are experiencing. These test only reaffirms the idea of some kind of confusion in your IDEs with other TeeChart installations or 3rd party components.

Re: Having TDGIPlus Within a DLL Causes Fault in XE4

Posted: Thu Jun 27, 2013 2:44 pm
by 16466189
I realize the difficulty you are having with this problem, but I still have the problem. I am running Windows 8 on a new machine that never had any other operating system. I am running C++ Builder XE4 Professional Update 1. There was no other C++ release on the system, and it was a clean install with update 1 being applied on top of it.

As I have said before regarding the problem. The test case that I sent will fail here using the lastest build files when I run the program from the IDE. If I just replace the redistribution files in the SysWOW64 directory with BETA files and rerun the test case from the IDE, the program will run. If I run the program outside the IDE, it will run without any problems.

I have to agree with you that in my case, the IDE seems to be doing something different. I should also add that I did the install of TeeChart using the binary that you supply and do not use the TeeInstall program. I need to install the software to gain access to the program, and by then, the work has already been done. If the binary install is different from the TeeInstall processing, then there could be a conflict in the install when setting up the packages for the IDE. But I do not think this is the issue.

Since the replacing of the redistribution files back to the BETA works, I would have to suspect that it has something to do with loading of the DLLs from the IDE. It is possible that the IDE is loading them in a different order than during program execution. As I said in an earlier post, I did get a warning message from Embarcadero after I applied update 1. It said something about TGDIPlus being declared in two DLLs. If this is the case, then it might be possible that the IDE loads the DLLs in a different order and that is causing the conflict. Regardless, something has changed about GDIPlus between the BETA and latest build.