I have read in forums about gpiplus problem in DLL, so I have tried to init gpiplus in main program , but it does not help :
// Before using DLL
Gdiplus::GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
// And after no more using the DLL
Gdiplus::GdiplusShutdown(gdiplusToken);
The strange thing is that it works in the development machine, if it was a gdiplus initialization issue (which might be) it shouldn't work there either.
Can you try by doing:
1)Wrap the code above into a try/catch block, and log the exception message somewhere, so we can have an idea of what the error is.
The methods in the dll should catch all the exceptions anyway, since those won't propagate to the calling app. There should be some error code and message set in the dll, so the BCB app can check if the call went ok.
2)Check if you are initializing GDIPlus in the main thread, not inside another thread. GdiPlus must be initialized from the main thread only, and this is why we can't do it when you are running in a dll.
"The strange thing is that it works in the development machine, if it was a gdiplus initialization issue (which might be) it shouldn't work there either."
I agree, so it's why I was thinking you are using external components (dll) which are surely not the same on my two machine.
We also use AdvApi32.dll and Crypt32.dll to read and write encrypted files (which despite their names are both available in win32 and win64), but that shouldn't really matter, since those are standard in any windows installation.
Just to be sure this isn't related to some corrupt/wrong dll, what happens if you create a console app in XE2, and write the same code as in the dll? Does it work when it is in a standalone exe, or does it fail too?
I would expect that it will work when compiled as an exe, but I'd like to be sure we aren't searching for the wrong problem. As while it is true that you need to initialize GDIplus when in a dll, it isn't normally problematic, you just initialize it and it works. So maybe there is something unrelated going on.
Have tried to put the two dll (AdvApi32.dll and Crypt32.dll) from my W7 to folder where is the console application (in WS2008), but problem still here.
We'll treat it as confidential and remove it once we are finished testing it.
I've further retested the console app in WS2012 and it seems to be working fine, I am waiting for a clean VM install of VS2008 to finish, but I don't expect it will give issues with my test file. So if I can get the file with actual issues, it might help a lot.
Thanks, I got the file, and I tested the c++ app you posted in both WS2008 R2 (freshly installed, "standard" setup) and 2012, but I couldn't see any errors. In both the pdf file was created correctly.
Some things to try:
1)I'd like to see if this is related to GDI+ or to the PDF engine. So can you try the following:
2)If 1) worked, then the next would be to see if this isn't related to the fonts (which are the most problematic issue when running pdf exports in a server, FlexCel needs to find and parse the ttf files).
What are the sheets that don't work? Is it sheet3? (which has a very big bitmap)
Also, are you still getting an external exception, or do you get any other message?
Just to make sure we are speaking about the same, if you try with code like this: (note I set active sheet to 3, I assume that one is the one with problems)
For message I don't know, I cannot check (can not debug on WS2008 client side)
I have only this :
Signature du problème :
Nom d’événement de problème: APPCRASH
Nom de l’application: Project1_png.exe
Version de l’application: 0.0.0.0
Horodatage de l'application: 00000000
Nom du module par défaut: rtl160.bpl
Version du module par défaut: 16.0.4504.48759
Horodateur du module par défaut: 4fa07358
Code de l’exception: c0000005
Décalage de l’exception: 0000c5a2
Version du système: 6.0.6002.2.2.0.400.8
Identificateur de paramètres régionaux: 1036
Information supplémentaire n° 1: 03af
Information supplémentaire n° 2: 8396fee4acafded33de0d392b63f54ec
Information supplémentaire n° 3: 4f4b
Information supplémentaire n° 4: bb17f27a87d29ec476f4628783d68895