The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: ecube on September 16, 2008, 05:21:54 PM

Title: callback function
Post by: ecube on September 16, 2008, 05:21:54 PM
I have a function in c++ that I compiled as a static lib, and I linked in that .lib in my asm project. After that I called the c++ function and passed it the address of a function in my main asm code as a callback. I tested it and it calls my asm function fine from the c++ lib and the asm function can read the string passed as a param ok, the problem is my program crashes when my asm callback function reaches the end and calls "ret", the debugger shows the address as 000000 any advice? :\


oh and when I call the c++ function(That calls my asm callback functionn) it's in another thread...not sure how much that affects things.


*FIX, sorry my asm function was fun proc C, and apparently it had to be stdcall so changing it fixed things, :)
Title: Re: callback function
Post by: Adamanteus on September 16, 2008, 06:05:35 PM
That's need by debugger in asm function look in dump of [ESP - 4], where placed return address. and check how it will correct be placed in EIP.