Powerbuilder Application Execution Error R0035 Better
PowerBuilder Application Execution Error R0035 is a runtime exception typically described as an " Error calling external object function
". It occurs when a PowerBuilder application fails to execute a method or access a property on an external component, most commonly an OLE (Object Linking and Embedding) Experts Exchange Primary Causes Missing or Unregistered Components
file required by the application is not present on the machine or has not been registered in the Windows Registry. Version Mismatch
: Conflicts between 32-bit and 64-bit architectures, or incompatible versions of third-party software like Microsoft Office (e.g., Outlook or Word integration). OLE Automation Timeouts
: The external server (like Excel or a custom COM server) takes too long to respond, causing the request to time out. Invalid Object References : Attempting to call a function on an that has not been successfully connected using ConnectToNewObject ConnectToObject SAP Community Recommended Solutions PowerBuilder Application Execution Error R0035!
The PowerBuilder Application Execution Error R0035 is a runtime error that specifically occurs when an application fails to call a function on an external object, typically an OLEObject or ActiveX control. 🛠️ Error Definition Error Code: R0035
Message: "Error calling external object function [function_name]"
Primary Cause: The application is attempting to execute a method on an external server (like Excel, Word, or a custom OCX) that is either not initialized, not registered, or has crashed. 🔍 Common Root Causes
The error usually stems from one of the following environmental or structural issues: 1. Unregistered or Missing OLE/ActiveX Components
The .dll or .ocx file required by the application is not registered on the client machine. This often happens during deployment to a new environment.
Fix: Use regsvr32 to register the missing component (e.g., regsvr32 mycontrol.ocx). 2. 32-bit vs. 64-bit Mismatch
A 32-bit PowerBuilder application cannot call a 64-bit OLE object, and vice versa. This is a frequent issue when migrating older applications to 64-bit environments.
Fix: Ensure the bitness of the application matches the registered version of the external object. 3. Uninitialized OLE Object
The OLEObject variable was declared but not properly connected using ConnectToNewObject or ConnectToObject before the function call.
Fix: Verify that the connection return code is checked before calling methods: powerbuilder
li_rc = myOleObj.ConnectToNewObject("Excel.Application") IF li_rc < 0 THEN // Handle connection error Use code with caution. Copied to clipboard 4. Out-of-Date Object Compilation
The calling object or its ancestor is "out of date" in the PowerBuilder library (.pbl), leading to a signature mismatch at runtime.
Fix: Perform a Full Build or manually Regenerate the object and its ancestors in the IDE. 🚀 Troubleshooting Steps powerbuilder application execution error r0035
If you are currently facing this error, follow this sequence to resolve it: PB 2019 OleObject not working? - Appeon Community
Missing or Unregistered Components: The required library (DLL, OCX, or VBX) is not registered on the system or is missing from the application path.
Automation Timeout: The OLE procedure call took longer than the internal timeout period (default is 5 minutes). If the request is expected to be long, the default may need adjustment.
Initialization Issues: Attempting to call a function on an object that has not been properly instantiated or connected via ConnectToNewObject.
State Errors: Calling a specific function when the object is in an invalid state, such as trying to print an image before one has been loaded. Resolution Steps
Register the Component: Manually register the relevant control using regsvr32 (e.g., regsvr32 mscomct2.ocx).
Adjust Timeout: Use the SetAutomationTimeout function to lengthen the allowed wait time for OLE calls if the server is slow.
Verify Object Connection: Ensure the OLEObject variable is successfully connected to the target application or control before calling its methods.
Debugging: If the cause is unclear, advanced users can use WinDbg to attach to the PowerBuilder process and capture the call stack at the moment of failure.
Are you seeing this error with a specific OLE object, such as Excel, Crystal Reports, or a custom ActiveX control? PowerBuilder Application Execution Error R0035!
Troubleshooting PowerBuilder Application Execution Error R0035
If you are a PowerBuilder developer or an IT administrator, encountering the "Application Execution Error R0035" can be a frustrating roadblock. This error typically surfaces during the application startup phase or when a specific window is being instantiated, essentially halting the program before it can perform its intended tasks.
In this guide, we will break down what this error means, its common causes, and the step-by-step solutions to get your application back up and running. What is Error R0035?
In the PowerBuilder ecosystem, execution errors prefixed with "R" refer to Runtime Errors. Specifically, Error R0035 indicates a "Link to reference failed" or an "Invalid object reference."
Essentially, the PowerBuilder Virtual Machine (PBVM) is trying to access a specific object, function, or library mentioned in the code, but it cannot find the definition or the "link" to that object is broken at runtime. Common Causes of R0035 There are three primary reasons why this link fails:
Missing or Mismatched PBLs/PBDs: The application is looking for a compiled library (PBD or DLL) that isn't in the system path or the application folder.
Version Mismatch: You might be running a newer version of the application executable (EXE) with older versions of the runtime libraries (PBVM DLLs), or vice-versa. PowerBuilder Application Execution Error R0035 is a runtime
Corrupt Object Definitions: An object (like a DataWindow or a User Object) within a library may be corrupt or failed to compile correctly during the build process.
Deployment Path Issues: The application’s search path (Environment Path) does not include the directory where the PowerBuilder runtime files are located. Step-by-Step Solutions 1. Verify the Runtime Files
The most common culprit is a missing runtime DLL. Depending on your version of PowerBuilder (e.g., 2019, 2022, or older versions like 12.5), ensure the following files are in the same folder as your EXE or in the Windows System Path: pbvm.dll pblib.dll pbtra.dll
Corresponding database drivers (e.g., pbtra.dll for SQL Server or pbor6.dll for Oracle). 2. Check the Deployment Search Path PowerBuilder looks for its libraries in a specific order: The directory where the EXE is located. The current directory. The Windows System directory. Directories listed in the PATH environment variable.
Ensure that if you have multiple versions of PowerBuilder installed on a machine, the System PATH isn't pointing to an older version’s Shared folder, causing a conflict. 3. Perform a "Full Build" and Re-deploy
Incremental builds can sometimes lead to "ghost" references where the compiler thinks an object exists in a certain state, but the compiled PBD doesn't match. Open your PowerBuilder IDE. Go to the Project Object. Select Full Build instead of Incremental Build. Regenerate all PBDs and the EXE. 4. Inspect the Application Log
If the error occurs on a client machine but not on your development machine, use a tool like Process Monitor (ProcMon) from Microsoft Sysinternals. Run ProcMon and filter by your application's EXE name.
Look for "FILE NOT FOUND" results. This will tell you exactly which DLL or PBD the application is searching for right before it throws the R0035 error. 5. Validate DataWindow Objects
Error R0035 often triggers when a Window tries to open a DataWindow that hasn't been included in the PBDs. Check your PBR (PowerBuilder Resource) file to ensure all dynamically assigned DataWindows or images are explicitly included in the build. Conclusion
The PowerBuilder Application Execution Error R0035 is almost always a deployment or environment configuration issue. By ensuring your runtime DLLs match your EXE version and performing a clean "Full Build," you can resolve the majority of these cases.
If the problem persists, verify that the client machine has the correct Visual C++ Redistributable packages installed, as modern PowerBuilder runtimes depend on these to execute their core C++ logic.
In PowerBuilder, the Application Execution Error R0035 is a runtime error defined as "Error calling external object function." It typically occurs when a PowerScript tries to execute a method or function on an external object—usually an OLE (Object Linking and Embedding) or ActiveX control—and the call fails. Common Causes
The error is rarely about the PowerScript code itself and usually points to environment or registration issues:
Unregistered OLE/ActiveX Controls: The specific .ocx or .dll file for the control being called is not registered on the target machine.
Missing Dependencies: The external object relies on other system files (like specific Visual C++ Redistributables) that are not present.
Object State Issues: The external OLE server may have crashed or "died" in the background before the function could be called.
Pathing Problems: The application cannot find the required DLL because it is not in the same directory as the executable or in the Windows System path. Some apps specify resource paths in
Bit-Alignment Mismatch: Trying to call a 16-bit DLL from a 32-bit application, or a 32-bit DLL from a 64-bit application. Troubleshooting and Solutions
Register the Control: Use the Windows Command Prompt (as Administrator) to manually register the required file: Command: regsvr32 "C:\Path\To\YourControl.ocx"
Verify Object Initialization: Ensure the OLE object is correctly instantiated (using CREATE or ConnectToObject) before calling its functions.
Check for Missing Files: Use tools like Dependency Walker to see if the external object is missing any required system libraries.
Implement Exception Handling: Wrap the call in a TRY...CATCH block for OLERuntimeError to capture more detailed information about why the call is failing without crashing the app.
Full Rebuild: If the error occurs after an upgrade, perform a Full Rebuild or Regenerate the objects in the PowerBuilder IDE to ensure all ancestor/descendant hierarchies are correctly compiled.
For more technical support, you can search for similar cases on the Appeon Community Q&A or the SAP Technology Q&A forums. PowerBuilder Application Execution Error R0035!
The PowerBuilder Application Execution Error R0035 is a common and specific error that occurs during runtime.
Official Definition: "System error: Error calling external object function %s at line %n."
In simpler terms, your PowerBuilder application is trying to execute a function inside an external object (like a DLL, an ActiveX/OCX control, or a COM object), but the call failed. It is essentially the PowerBuilder equivalent of a "File Not Found" or "Method Not Found" error when dealing with external technologies.
Here is a comprehensive guide to troubleshooting and resolving Error R0035.
10. Review the application’s INI or config file
- Some apps specify resource paths in
.inior.cfgfiles. Look forPBRPath=or similar entries.
Example scenario & resolution
Problem: R0035 reports missing "PBVM.DLL" on startup.
Fix: Copy correct PBVM.DLL (matching app’s bitness and PowerBuilder version) into the app folder; ensure any required PowerBuilder runtime DLLs and PBD runtime files are present; restart app.
Affected PowerBuilder Versions
This error can appear in any version (from PB 6.5 to PB 2022), but the DLL filename varies:
| PowerBuilder Version | Core DLL | |----------------------|-----------| | PB 6.5 | pbvm65.dll | | PB 7.0 | pbvm70.dll | | PB 8.0 | pbvm80.dll | | PB 9.0 | pbvm90.dll | | PB 10.5 | pbvm105.dll | | PB 11.5 | pbvm115.dll | | PB 12.5 | pbvm125.dll | | PB 15.0 | pbvm150.dll | | PB 2017 | pbvm170.dll | | PB 2019 | pbvm190.dll | | PB 2021 | pbvm210.dll | | PB 2022 | pbvm220.dll |
Example Scenario
You deploy a PowerBuilder app sales.exe with sales.pbr. On a user’s machine, the error appears because sales.pbr was accidentally omitted from the installer. Copying the file to the same folder as sales.exe resolves the issue.
5. Set correct working directory
- Launch the executable from its own directory, not via a shortcut with a different working folder.
- Use full paths if necessary, or set the current directory before calling the executable.
Step 5: Enable PowerBuilder Debug Logging
Set environment variables before launching:
PBTRACEFILE=C:\temp\pb_debug.log
PBTRACEENABLE=1
Re-run the app. The log will show exactly which PBD failed to load and why (file not found, access denied, bad format).
Prevention Best Practices
| Practice | Benefit | |----------|---------| | Use runtime packager | Ensures all dependencies are correctly registered. | | Deploy with XCOPY | Simple file copy avoids registry corruption. | | Maintain version consistency | Prevents mismatch between EXE and PBVM. | | Test on clean VM | Identifies missing dependencies early. | | Document runtime version | Include PB version in deployment notes. |