Re: Pointers to DLLs

From: Conrad Weyns <weyns_at_online.no>
Date: Tue, 21 Oct 2003 09:38:13 +0200

----- Original Message -----
From: "Jeffrey Massung" <jma_at_mfire.com>
To: <sftalk_at_forth.com>
Sent: 20. oktober 2003 22:47
Subject: [sftalk] Pointers to DLLs

> More DLL fun.. Hopefully someone can help me with this little problem. I =
> all
> boils down updating a pointer passed to a C++ function.
>
> Here's the C++:
>
> extern "C" DLL_EXPORT void increment(int *x)
> {
> (*x)++;
> }

Have you tried:
    int increment(int* x)

I think IMPORT's glue code expects a return. This change in interface may
cause the offset to x to change (depending on the calling convention - I
havn't done this for years but I think it is worth a try)

Regards,
Conrad Weyns

>
> Now the Forth:
>
> LIBRARY mydll.DLL
> 1 IMPORT: increment
>
> VARIABLE x
> 1 x !
>
> x increment DROP
> x ?
>
> Well, this fails. No error is produced, but the results are invalid, and =
> SF
> spits out a value (to the console) after execution of 'increment'. Perhap=
> s I'm
> missing something or not doing this right?
>
> Any ideas appreciated, thanks!
>
> Jeff
>
>
> ----------------------------------------------------------------------
> 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 Tue Oct 21 2003 - 00:43:12 PDT


Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!

This archive was generated 06-Feb-2012. Archive updated nightly.