I have the task of writing a communications library for an RS232 serial comm port magstripe reader. I am writing the library in visual C++ with MFC. The functions in this library will be called from a legacy program written in PowerBuilder 6.5. So far, PowerBuilder successfully calls the function within the dll and it works correctly, but when control returns from the dll to the PowerBuilder function, I am getting this error from PowerBuilder:
**************************************
Error Number 42
at line number 1
of Event open
in Object w_test_window
in Window w_test_window
Specified argument type differs from required argument type at runtime in DLL function isbadgereaderpresent.
(invalid stack pointer on return from function call)
**************************************
Here is the C++ function declaration in the dll:
extern int EXPORT IsBadgeReaderPresent(DWORD dwComPort)
In PowerBuilder, you have to declare a prototype for the external function. Here it is:
FUNCTION int IsBadgeReaderPresent(long lComPort) library "C:\projects\nfs_comm\nfs_comm\debug\nfs_comm.dll"
And finally, here is how the function is actually called from PowerBuilder:
IsBadgeReaderPresent(1)
The PowerBuilder code is version 6.5; the C++ code is being compiled with Visual Studio .NET 2003. Does anyone have any idea about why I am getting an error???
**************************************
Error Number 42
at line number 1
of Event open
in Object w_test_window
in Window w_test_window
Specified argument type differs from required argument type at runtime in DLL function isbadgereaderpresent.
(invalid stack pointer on return from function call)
**************************************
Here is the C++ function declaration in the dll:
extern int EXPORT IsBadgeReaderPresent(DWORD dwComPort)
In PowerBuilder, you have to declare a prototype for the external function. Here it is:
FUNCTION int IsBadgeReaderPresent(long lComPort) library "C:\projects\nfs_comm\nfs_comm\debug\nfs_comm.dll"
And finally, here is how the function is actually called from PowerBuilder:
IsBadgeReaderPresent(1)
The PowerBuilder code is version 6.5; the C++ code is being compiled with Visual Studio .NET 2003. Does anyone have any idea about why I am getting an error???