Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DECLARE DLL problem
Message
From
14/11/2001 03:41:17
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
13/11/2001 16:34:07
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00580332
Message ID:
00581345
Views:
31
>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
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform