I am working on a class to wrap the libcurl dll functions. This class will be able to work with secure FTP servers.
I have to set up some callback functions for libcurl, for that I am using the vfp2c32.fll
This is the code that is working fine, the libcurl function prototypes are copy/pasted from libcurl.h:
*!* typedef size_t (*curl_read_callback)(char *buffer,
*!* size_t size,
*!* size_t nitems,
*!* void *instream)
This._CurlReadCallBackAddress = CreateCallBackFunc("CurlReadCallBack", "INTEGER","INTEGER,INTEGER,INTEGER,INTEGER", This, 1)
*!* typedef size_t (*curl_write_callback)(char *buffer,
*!* size_t size,
*!* size_t nitems,
*!* void *outstream)
This._CurlWriteCallBackAddress = CreateCallBackFunc("CurlWriteCallBack","INTEGER","INTEGER,INTEGER,INTEGER,INTEGER", This, 1)
*!* typedef int (*curl_debug_callback)
*!* (CURL *handle, /* the handle/transfer this concerns */
*!* curl_infotype type, /* what kind of data */
*!* char *data, /* points to the data */
*!* size_t size, /* size of the data pointed to */
*!* void *userptr); /* whatever the user please */
This._CurlDebugCallBackAddress = CreateCallBackFunc("CurlDebugCallBack","INTEGER","INTEGER,INTEGER,INTEGER,INTEGER,INTEGER", This, 1)
And the following code causes an error "Declare dll caused an exception", when curl_easy_perform is called. It seems that the callback functions are called just once, and then the error fires.
*!* typedef int (*curl_progress_callback)(void *clientp,
*!* double dltotal,
*!* double dlnow,
*!* double ultotal,
*!* double ulnow)
This._CurlProgressCallBackAddress = CreateCallBackFunc("CurlProgressCallBack","INTEGER", "INTEGER,DOUBLE,DOUBLE,DOUBLE,DOUBLE", This, 1)
*!* typedef int (*curl_seek_callback)(void *instream,
*!* curl_off_t offset,
*!* int origin); /* 'whence' */
This._CurlSeekCallBackAddress = CreateCallBackFunc("CurlSeekCallBack", "INTEGER","INTEGER,INTEGER,INTEGER", This, 1)
I guess there is a problem matching the C data types to the vfp2c32.fll data types used in CreateCallBackFunc. Also, I don“t know what a curl_off_t is.
I can only go so far with this, if anyone is willing to take a look, here is what you need:
http://www.ctl32.com.ar/ctl32_curl.aspIt would be great if this could work properly, it will make possible to use FTPS from VFP easily, and best of all, free.
Carlos Alloatti