on 08-23-2016 7:26 PM
Hi,
I'm migrating an application from PowerBuilder 7 to PowerBuilder 12.5.2 and I have a frustrating problem that hopefully some has encountered and knows the answer to.
When I compile (P Code) the code and run the it, it will crash at the end of a function or open event.
The application open event calls a function and after every line of code is executed in the function the application will crash and not return to the open event.
So, I copied the function code into the application Open event and when it runs it executes all the copied function code and continues to the end of the open event and then crashes.
Does anyone have any ideas?
I'm running 64 bit Windows 7.
Thanks,
Gary
Hi Gary;
Can you tell us ...
1) Before you migrated ... did you run the PB 12.6 Migration Assistant on your PB 7 code to see if it was OK? Some identified problems may need to be cleaned up in your PB 7 IDE first.
2) Does the application run OK from the IDE?
3) After migration ... did you Optimize all your PBL's?
4) Does this application call external DLL's?
5) Do you have any other versions of PB installed besides PB 12.5.2 and 7?
6) Is the PB 12.5.2 run-time DLL path first in your System Path before PB 7?
Regards ... Chris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Chris for quick reply
1) Yes, and everything was cleaned up
2) Yes, but it takes a different logic path. The EXE is started by another app that passes it credentials to logon to a Service Object Gateway to access NonStop data.
3) No, I'll try that now
4) Yes, 3 of them
5) I just have PB12.5.2 installed
6) PB7 is not installed
Thanks,
Gary
Hi Gary;
I would be suspicious of #4 - external DLL's. Remember that PB 10.0 and higher is Unicode vs PB 7 which was ANSI based. So if your calling MS-Windows SDK external functions especially, I would seriously think about converting these to Unicode calls (aka Double Byte) - especially, if you are passing string or character based arguments into the method.
The other issue would be related and that is calling 3rd party external DLL's where the DLL is ANSI based and PB 12.6 is Unicode based.
Food for thought.
Regards ... Chris
Hi Chris,
You were right.
So, the external call seems to work and return the correct answer BUT at the end of the event 80 lines later it causes the application to crash.
Here is line of code.
lb_ret = glGetIPAddress(ls_IPAddress)
Here is the Declaration
Function Boolean glGetIPAddress ( REF string IPAddress) Library "GL32.DLL" alias for "glGetIPAddress:Ansi"
How do you sugguest I modify this to make it work?
Thanks,
Gary
Are you initializing ls_IPAddress first? Something like this:
ls_IPAddress = Space(15)
If that doesn't work, I have a couple of examples that include a Get IP Address function.
http://www.topwizprogramming.com/freecode_ping.html
Also the Winsock example.
Thanks Roland,
I didn't try that yet but I did find something that worked.
I did this before I called the function and the App never crashed.
Blob lb_IPAddress
ls_IPAddress = String(lb_IPAddress,EncodingANSI!)
I'm going to try what you sugguested next before I fix the other 30 or External Functions.
Thanks Everyone for all you help! Very much appreciated!
Have you tried to run the application with /pbdebug to see whats the last statement was? Maybe it something other in systemerror, idle or close event or there are some infinite loops?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gary
All good advice above from Chris & Roland.
I think you need to isolate what code is causing the crash. I would start to comment out stuff that is not needed. I would look at constructor events on instantiated objects, what are they doing?
You could post the code in the application open event, it may help us give some pointers.
Cheers
David
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Are you calling any external functions (Windows API functions)?
PowerBuilder string & char variables are now Unicode (2 bytes per character) as opposed to PB 9 and earlier which was Ansi (1 byte per character). Many functions have an A or W at the end of their name. You should use the W version. Some functions have an argument that is the number of characters while others it is the number of bytes. In Ansi these two are the same.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.