cancel
Showing results for 
Search instead for 
Did you mean: 

Powerbuilder 12.5.2 crashes at end of code

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

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!

Former Member
0 Kudos

I thought about suggesting using blob, that is a good idea. I do that for functions that don't have a Unicode version.

Answers (3)

Answers (3)

Former Member
0 Kudos

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?

Former Member
0 Kudos

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

Former Member
0 Kudos

Thanks David,

I done lots of commenting out of the code and inserting message boxes to tell where it dies.

It was always died after all the code in the function or all the code in the open event completed successfully. That's the weird part.

This is from the Windows Event Viewer.

Former Member
0 Kudos

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.

Former Member
0 Kudos

Thanks Roland,

The App calls Kernel32 and User32 functions but not in the open event.

I'm going look into this anyways, it may be the problem.

FYI.  I've posted the Event Log Error in the next post down.

Thanks,
Gary