cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Migrating to Crystal 64-bit questions

AndersG
Active Participant
0 Likes
1,948

Hi!

The time has finally come to port our app to 64-bits as support for 32-bit Crystal is ending. We also hope that 64 bits will help with the memory issues we have been having with Crystal. So, basically will the code (C++/MFC) be ported to 64-bits that project is underway. 

The app calls:

using namespace CrystalDecisions::Shared;
using namespace CrystalDecisions::CrystalReports::Engine;
using namespace CrystalDecisions::Windows::Forms;
using namespace CrystalDecisions::CrystalReports::Engine;
using namespace CrystalDecisions::Windows::Forms;

For printing. I guess we just install the 64-bit runtime right?

For 32-bits, we also have a two UFL DLLs written aeons ago in C. I guess the proper thing is to rewrite them using the C# .Net stuff? Ie: https://userapps.support.sap.com/sap/support/knowledge/en/1603381

Anything else to watch out for?

Accepted Solutions (1)

Accepted Solutions (1)

DonWilliams
Active Contributor
0 Likes

Hi Anders,

I see you have finally decided to move to 64 bit....

Nothing else to do except change your project from x86 to x64. Not sure about Managed C++ but in C# when you change it you'll notice all of the CR References path will change to the 64 bit CR folder.

See this KBA on using C# to rewrite your UFL, sample attached, the one you posted is old when you had to manage string length manually:

https://userapps.support.sap.com/sap/support/knowledge/en/1525014

PS - Memory issues are usually due to not Releasing App Objects, CR Reports, DataSets' etc. Or could be third party leaks. SAP Dev constantly look for them and fix if possible, sometime they are 3rd party and they can't fix them.

If you found some post a new question and I'll get R&D to look into them. PS don't write a simple test app that cycles through report, it take CR about 100 iterations to allow Windows to catch up...

Also, you added using namespace CrystalDecisions::Windows::Forms; twice? is this a typo or are you loading to instances of the Viewer?

AndersG
Active Participant
0 Likes
Thanks. The forms stuff is a typo. I am not ruling out that calling Net from c++ causes issues, but for now the app seems to stay at 85Mb even when I output the same printout to screen, repeatedly.
DonWilliams
Active Contributor
Hi Anders, oh, but you said "We also hope that 64 bits will help with the memory issues we have been having with Crystal". My Main test app is only 50Mb, after I load and view a report, it likely goes higher if I export... Thanks again... Don
AndersG
Active Participant
0 Likes
Thanks Don. I will start looking at the new UFL stuff today. As for printjobs, we have this routine where the user can create a list of reports that are printed every month and we have run into issues there with very large jobs, say 40+ and when the users test by printing them all to screen. You easily hit 1Gb RAM then.
AndersG
Active Participant
0 Likes
OK. FWIW, the project will lot load in VS2022, but loads in VS2017. It also need the xerxces-c package downloaded and built
AndersG
Active Participant
0 Likes
OK. Sorry. No need for the Xerces stuff. It is just that that control implements an XML lookup. So forget everything I said about that. On this development machine with the 64 bit runtime, the DLLs are at C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win64_x64 and win32_86. Is the built-in editor for Visual Studio 32 or 64 bits? Ie do I need to have both 32 and 64 bit versions of the DLL even if the app is 64 bits? Once I get the project sorted, then I will try opening it in VS2022 and then send it to you.
AndersG
Active Participant
0 Likes
OK. One small question. I have a crdates.h and crdates.c that implement CRYearMonthDayToDate and CRDateToYearMonth Day. Is there a more modern implementation than the one marked 1993-2002? 🙂 Or should I try converting it?
AndersG
Active Participant
0 Likes
Sorry Don of I was unclear. The issue is not date functions per se but rather the UFL we wrote that takes a Finnish SSN and returns the age as a number, the birthdate as a date and this years birthday as a date. So the question is more: How do I receive and unpack a date in an UFL and how do I return a date? The functions I mention takes a year,month,day and returns a CR Date and vice versa
DonWilliams
Active Contributor
0 Likes
Hi Anders, ah so in C# I use the Windows DateTime() function: public struct DateTime I think you should be able to convert the C++ DateTime functions to C# and then format the outout according to CDate formating... I hope that answers your question?
AndersG
Active Participant
0 Likes
I was able to blag what I needed from CRDATES.* and put those in the main source file. BTW, in the sample project, there is a /SAFESH in additional parameters, that need sto be changed to /SAFESH:NO for x64
DonWilliams
Active Contributor
Thanks Anders. not sure "blag" means, I'm Canadian... lol Thhanks for the x64 build info, I can't edit anything now because I'm retired so hopefully if others have issues they will either find this post or figure it out as you did... Thanks again Don
AndersG
Active Participant
0 Likes
Sorry 🙂 "to persuade someone in a clever or slightly dishonest way to allow you to do something or to give you something:" - In this case meaning "copy". Ie I persuaded the old sources to give me their secrets. Have fun as a retired person and please hang out here as you have lots of knowledge accumulated over the years!
AndersG
Active Participant
0 Likes

Just one small addition: The later versions of Visual studio does not take the old APIs insistence on byte padding so to compile under VS2022 you need to do this:

#pragma pack(push, 8 )

#include <windows.h>

#pragma pack(pop)

#include "ufls/ufdllunicode.h"

#include "ufmain.h" #etc

That sets the packing to windows default which is 8 and then back to 1

Answers (1)

Answers (1)

DonWilliams
Active Contributor
0 Likes

Hi Anders,

Wow those are really old, CR added those Date functions in CR 7 I believe. You could rewrite them using .NET sample UFL pasted the link to.

For one you can use:

CDate

Overloads

  • CDate (number)

  • CDate (string)

  • CDate (dateTime)

  • CDate (YYYY, MM, DD)

It will however force you to edit each report.