Reputation: 313
I seem to be having an issue when it comes to calling C# code from PowerBuilder, but it only affects some computers.
The program itself is a simple program that allows you to send an E-mail. The application has been written in PowerBuilder 11.2, while the SMTP part has been written in C#/C++ which is created in a Mail.dll file.
When the PowerBuilder application runs, it works 100% on almost all the computers at my work. There are a select few where it crashes at the following line
cmail mail = CREATE cmail
But as I said, it is only on a few machines. All machines are Dell Desktops, running Windows 7 64-bit with 2.0GB Ram.
The DLL file is placed at C:\Program Files (x86)\Sybase\PowerBuilder 11.0\, and that same path has been added to the PATH variable.
Are there any tips I could go on to attempt to figure out what could be wrong? My belief is that some machines cannot find the DLL even though the file path is in the system PATH, and that the computers are practically identical.
Thank you.
EDIT: Here is the error that it is throwing at us:
Application Terminated.
Error: Bad runtime function reference at line 11 in clicked even of object cb_send of w_email
Upvotes: 1
Views: 1281
Reputation: 61
Just a thought here. The fact that it's working on so many machines and not on two or three makes me lean in the direction that it's a configuration/deployment issue. When I've been in situations like this, I usually pull out Dependency Walker and check to see what files that may or may not be needed by your dll are missing (or not missing).
I would run this on a machine that is working and on one of the machines that isn't working. This should get the information you need to get this issue corrected on these machines.
Let me know if this helps you out. I'm curious to hear what it was.
Upvotes: 1
Reputation: 313
Ended up finding out what the problem was. The problem was associated with the building of the .dll through DEBUG mode.
If a .dll is in DEBUG mode, it uses a special version of the .NET Framework that is only available from VisualStudio 20xx.
Simply changing it to RELEASE build allowed this to function on all computers.
Upvotes: 1
Reputation: 2464
Is there the potential for 'null' objects to be passed into the API from Powerbuilder?
I just fixed an issue like this. The C# code had to be updated to also check for System.DBNull in addition to null for some parameters, otherwise a cast exception occurs, which if unhandled ends up displaying a message like what you described in the PB app.
Upvotes: 0