Hi Ron and all,

I've sent a message on january the 7th with the same Subject, I think I've
found what makes my code give an error; but now I'm getting a new error:

Unrecoverable error 9020: An item was going to be copied to itself from
hb_itemCopy()

So, the previous version was working ok, the new one, does not give the
previous error, but a new one during the execution of the process.


Anyway, in my code I was calling, from .prg to .c, a function with this syntax:


if __ClsMsgAssigned( Self, "READ" )
   curl_easy_setopt( ::pcURL, CURLOPT_WRITEDATA, Self )
endif

So, I was calling C code passing to it Self, the C code function was written
this way:

HB_FUNC(CURL_EASY_SETOPT)
{
   CURL * curl = hb_parptr( 1 );
   CURLcode res = 0;
   int iOption = hb_parni( 2 );
   PHB_ITEM pObject = NULL;
   PHB_DYNS pSym_AddSList = NULL;

   if ( iOption == CURLOPT_WRITEDATA ) {
      res = curl_easy_setopt( curl, CURLOPT_WRITEFUNCTION, write_function );

      pObject = hb_param( 3, HB_IT_OBJECT );
      res = curl_easy_setopt( curl, iOption, pObject (void *) hb_itemNew(
pObject ) );

...

}

Please note that the 'Self' I'm receiving is used to call hb_itemNew( pObject
) which is than associated with the curl pointer through the call to
curl_easy_setopt().

This code is an OO version of contrib\hbcurl, by the way.

Now, If I don't call hb_itemNew(), but I simply pass pObject to
curl_easy_setopt() I don't have anymore the:

Unrecoverable error 9000: Destructors disabled! Destructor of class: 'TFTP'
can't be executed.
Called from hb_vmQuit()

but I have the new error as I said before, so the question is: what is the
correct way to handle this issue?

I have to add that I've seen this hb_itemNew() to associate a .prg object to
some .c variable before, for example inside hwGUI (if I'm not wrong) and it
was working OK in my program up to a few months ago.

Is this description enough to see where is the 'problem'?

Maurilio.

PS. I did try to create a self contained example, but I was not able to have a
small piece of code showing this problem.


-- 
 __________
|  |  | |__| Maurilio Longo
|_|_|_|____| farmaconsult s.r.l.



------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
xHarbour-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xharbour-developers

Reply via email to