![]() |
||
| Home | SwiftForth Archive | SwiftX Archive | |

Chuck,
Try this (untested - may need tweaking)
\ Expects 2 parameters on Forth Data Stack
CODE CALL-FUNC2 ( n1 n2 addr -- n3_see-below )
2 CELLS [EBP] EDX LEA
EDX PUSH \ Save Forth Environment
ESI PUSH
EDI PUSH
\ Next we build our C stack frame
0 [EBP] PUSH \ first parameter
4 [EBP] PUSH \ second parameter
3 CELLS # EBP ADD
EBX CALL \ Call DLL Procedure
2 ( #cells ) CELLS # ESP ADD \ Discard C stack frame
EDI POP \ Restore Forth Environment
ESI POP
EBP POP
EAX EBX MOV \ Use this if proc returns data
\ POP(EBX) \ Use this if no return data
RET END-CODE
Let us know if this works.
Mike
-----Original Message-----
From: sftalk-bounce_at_forth.com [mailto:sftalk-bounce_at_forth.com]On
Behalf
Of Chuck Carlson
Sent: Sunday, July 20, 2003 9:43 PM
To: sftalk_at_forth.com
Subject: [sftalk] Calling external procedure
Hello,
I'm trying to call a procedure in a DLL. The procedure is not
imported via CIMPORT though. The address of this procedure is
obtained as follows:
library AARDVARK.DLL
1 cimport: aa_load_function
Z" aa_find_devices" aa_load_function
Now I've got the address of function aa_find_devices(int a,int b) on
the stack but I don't know how to call it and I have to pass 2 args to
it as well.
What's the next step?
Thanks,
Chuck
----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe" to sftalk-request_at_forth.com
For list command help, send subject "help" to sftalk-request_at_forth.com
Message archives are located at http://www.forth.com/archive/sftalk
----------------------------------------------------------------------
This list is a forum for SwiftForth users. For product support and
bug
reports, please send email to support_at_forth.com
----------------------------------------------------------------------
----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe" to sftalk-request_at_forth.com
For list command help, send subject "help" to sftalk-request_at_forth.com
Message archives are located at http://www.forth.com/archive/sftalk
----------------------------------------------------------------------
This list is a forum for SwiftForth users. For product support and bug
reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Mon Jul 21 2003 - 07:52:29 PDT
This archive was generated by hypermail 2.2.0 : Tue Dec 02 2008 - 03:04:33 PST