Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DECLARE DLL problem
Message
De
15/11/2001 12:03:43
 
 
À
15/11/2001 02:46:43
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00580332
Message ID:
00582186
Vues:
31
Cetin and Ed:

With your help now this code is working. But sometimes DoubleToNum function provokes C000005 error.

Indeed I am forgetting something.

Alejandro Fernandez

>Then on passing parameter to DLL initialize it to replicate(chr(0),8*nDoubles).
>Cetin
>>Thanks to Cetin and Ed. I am trying these advices.
>>
>>One more thing, On calling my DLL, my array is sent empty, it is returned filled by it. Just, this is the data I am needing. Are you Ok?
>>
>>Thanks.
>>
>>Alejandro Fernandez.
>>
>>
>>>>Well, as I understand funtion DoubleToNum it converts data to valid double one before calling DLL. The following is the code I use:
>>>>
>>>>set proce to clsheap addi && Ed clsheap class
>>>>
>>>>ascmx = replicate(chr(0),8*10)
>>>>xdata =DoubleToNum(ascmx) && Is this OK ?
>>>>
>>>>retval=MyDll(,,@xdata)
>>>>
>>>>The C0000005 error appear after that.
>>>>
>>>>Must I convert LONG data type too?
>>>>
>>>>
>>>>Thanks.
>>>>
>>>>Alejandro Fernandez
>>>
>>>Alejandro,
>>>I think you got it wrong. In order to pass an array of doubles, first each double should be converted to string then concatanated. On return string is parsed and converted to num :
>>>
>>>
dimension myDoubles[6]
>>>myDoubles[1] = 19292.3773
>>>myDoubles[2] = 1929243234343
>>>...
>>>
>>>lcDoubleParm = ''
>>>for ix=1 to alen(myDoubles)
>>> lcDoubleParm = lcDoubleParm + CopyDoubleToString(myDoubles[ix])
>>>endfor
>>>
>>>* DLL call with @lcDoubleParm
>>>* Convert back to nums
>>>dimension myRetDoubles[nDoubles]
>>>for ix=1 to nDoubles && nDoubles might be constant, returned by DLL etc
>>>  myRetDoubles[ix]=DoubleToNum(substr(lcDoubleParm, (ix-1)*8+1, 8))
>>>endfor
Cetin
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform