Re: Re[2]: [Haskell-cafe] FFI, C/C++ and undefined references

2010-01-14 Thread Stephen Tetley
2010/1/14 Bulat Ziganshin : > there is better way rather than playing with random bits. just find > tutorial on FFI, and try it. once this example works, start modifying > it to learn various aspects of ffi and add functionality you need Also binding to a C library is easier than binding to a C+

Re[2]: [Haskell-cafe] FFI, C/C++ and undefined references

2010-01-14 Thread Bulat Ziganshin
Hello DNM, Thursday, January 14, 2010, 10:42:42 PM, you wrote: there is better way rather than playing with random bits. just find tutorial on FFI, and try it. once this example works, start modifying it to learn various aspects of ffi and add functionality you need it's one thing i've learned i

Re[2]: [Haskell-cafe] FFI, C/C++ and undefined references

2010-01-14 Thread Bulat Ziganshin
Hello Daniel, Thursday, January 14, 2010, 11:08:24 PM, you wrote: i think you are wrong. stdcall used for std windows dlls, but gcc by default generates ccall things. and cl anyway useless here > Just an idea. Are you on windows? > If so, then your foreign calls would probably have to be > fore

Re[2]: [Haskell-cafe] FFI, C/C++ and undefined references

2010-01-13 Thread Bulat Ziganshin
Hello Brandon, Thursday, January 14, 2010, 7:40:45 AM, you wrote: > Really, the only reason in this case is that there is no equivalent > for `extern "C"' that you can apply to a function definition, only to > a declaration it works with GCC: extern "C" int c_szOpenArchive (TABI_ELEMENT* params)

Re[2]: [Haskell-cafe] FFI, C/C++ and undefined references

2010-01-13 Thread Bulat Ziganshin
Hello DNM, Thursday, January 14, 2010, 7:07:43 AM, you wrote: > Yes, I thought of doing this, but then thought it was better to use a > so-called "managed" foreign pointer via newForeignPtr. i recommend to use Ptr and switch to ForeignPtr only when you will study how to use it. overall, unsafe*