As i implemented dll in big project,
In one module of my project,
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<br />
at line number 1<br />
of Event open<br />
in Object w_test_window<br />
in Window w_test_window<br />
Specified argument type differs from required argument type at runtime in DLL function isbadgereaderpresent.<br />
(invalid stack pointer on return from function call)
**************************************
Here is the C++ function declaration in the dll:
extern int EXPORT IsBadgeReaderPresent(char *strComPort = "COM1")
In PowerBuilder, you have to declare a prototype for the external function. Here it is:
FUNCTION int IsBadgeReaderPresent(string strComPort) library "Cprojects\nfs_comm\nfs_comm\debug\nfs_comm. dll"
And finally, here is how the function is actually called from PowerBuilder:
IsBadgeReaderPresent("COM1")
Does anyone have any idea about why I am getting an error???
__________________
Thanks in advanced
specially all those who help me for dll implentation
EDIT:
One more bit of information:
If I take out the passed parameter, the function works as expected with no errors. This works:
extern int EXPORT IsBadgeReaderPresent()
Obviously the problem here is that I am no longer passing in the com port number that I want to check (i.e. I have to hard-code a com port number into the dll).
____________________________________________________________________
EDIT:-
I am not found the solution after spending all morning surfing Google Groups.
Is Some understand problem.
Please provide single reply
EDIT:-
_________________________________________________________________________________
I was spend 15 days on google there not solution on this.Is this bug of microsoft??????
Can any body tell me even this.............