3
votes

I am trying to understand the need for PBNI. I would like to get your take on it. I see that it's fashioned after Java JNI. With a security model that Java has, I can understand why they needed a JNI.

But with PB, don't we have access to all the windows API already? Also, we could always makes calls to functions in an external DLL. With this, what is the need for a separate PBNI? I know, I am missing something here. What type of applications/libraries would use PBNI as against a simple DLL or Activex component.

Also, I am using PB 10. Is this continued in 11 and 12 and beyond?

I appreciate any feedback, comments or suggestions about this technology. Thanks a lot again for your input.

Sam

1

1 Answers

5
votes

The purpose of PBNI is to allow PowerBuilder to be extended. When you add an object or function via PBNI, it becomes on par with the built-ins in PowerBuilder. This is also true of controls in PBNI, you can just drag them out of the System Tree and drop them on your window. Some of the useful things I've seen in PBNI include bit-twiddling, custom string operations, and canvas controls. You can also use PBNI to talk to anything else you'd like. IIRC someone made an interface that let you call Python. The SOAP library for PB Classic also comes to mind.

With regard to the Windows API, you can call quite a few useful things, but you immediately hit the wall if something needs a callback. Also if you need a structure of types PowerBuilder can't make, you have to program MoveMemory commands to shove the data around.