I created a callback from PowerBuilder to C++ by using some PBNI (like JNI, but for PowerBuilder) trickery. Basically, the PowerBuilder application ran and loaded the external C++ library to handle expensive calculations. From the C++ DLL, I hooked into the PowerBuilder virtual machine, looked up a particular custom object and method, and then used the method as a callback. This wasn't the evil or immoral part though.
The hack was cool, but utterly stupid and pointless (the C++ was used for speed - calling back into PowerBuilder defeated the purpose). The only reason I did it was because the consultant who originally created the C++ DLL managed to convince my boss that the application would run much faster if PowerBuilder supported callbacks. So naturally my boss instructed me to do the impossible. I didn't complain because it seemed like a fun challenge at the time. I didn't tell him that it actually slowed the app down a bit though >:)
The hack was cool, but utterly stupid and pointless (the C++ was used for speed - calling back into PowerBuilder defeated the purpose). The only reason I did it was because the consultant who originally created the C++ DLL managed to convince my boss that the application would run much faster if PowerBuilder supported callbacks. So naturally my boss instructed me to do the impossible. I didn't complain because it seemed like a fun challenge at the time. I didn't tell him that it actually slowed the app down a bit though >:)