Hi!

I want to call a function ([1]) from a dynamic library under Windows. At first I tried to call MessageBox from "user32.dll" and failed to do it under gambit. When I tried DrScheme and it worked fine. Here is the source:
(module dr-scheme-ffi mzscheme
 
  (require (lib "foreign.ss"))
  (unsafe!)
  (define user32.dll (ffi-lib #f))
 
  (define mbox
    (get-ffi-obj "MessageBoxA" user32.dll
                 (_fun _pointer _string _string _int -> _int)))

  (mbox #f "Message body here" "Caption here" 0)
)

I've searched through the whole gambit-list, but no one seems to discuss the theme. What is the correct way to call an exported function in a dll from gambit scheme? (Let them be at first MessageBoxA and user32.dll).

Thanks in advance,
Nick.

-----------------------------------------------------------
[1]:
http://msdn2.microsoft.com/en-us/library/aa915312.aspx
//        BOOL ReadProcessMemory(                        
//            HANDLE hProcess,                    //[in] Handle to the process whose memory is being read.
//            LPCVOID lpBaseAddress,              //[in] Pointer to the base address in the specified process to be read.
//            LPVOID lpBuffer,                    //[out] Pointer to a buffer that receives the contents from the address space of the specified process.
//            DWORD nSize,                        //[in] Specifies the requested number of bytes to read from the specified process.
//            LPDWORD lpNumberOfBytesRead         //[out] Pointer to the number of bytes transferred into the specified buffer.
//            );