Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Carlos Alloatti
  Where is Carlos Alloatti?
 
 Argentina
 Carlos Alloatti
 Tags
Subject: Libcurl and vfp2c32.fll
Thread ID: 195910 Message ID: 195910 # Views: 109 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Win32API programming
Date: Tuesday, September 23, 2008 10:14:58 PM         
   


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.asp

It 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




COMPLETE THREAD

Tip: click here to scan for Windows Registry Errors and Optimize PC performance
Libcurl and vfp2c32.fll Posted by Carlos Alloatti @ 9/23/2008 10:14:58 PM
RE: Libcurl and vfp2c32.fll Posted by Borislav Borissov @ 9/24/2008 9:01:09 AM
RE: Libcurl and vfp2c32.fll Posted by Carlos Alloatti @ 9/24/2008 3:27:58 PM
RE: Libcurl and vfp2c32.fll Posted by Craig Boyd @ 9/25/2008 11:18:18 AM
RE: Libcurl and vfp2c32.fll Posted by Carlos Alloatti @ 9/25/2008 6:45:16 PM
RE: Libcurl and vfp2c32.fll Posted by Eduard @ 10/14/2010 1:07:52 AM