Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problems with DECLARE command
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00753679
Message ID:
00753741
Views:
10
Well, it should be a way to avoid allocating such an amount of memory.

Only if there is no other choice but to allocate do it this way:

- in declaration change from STRING @ to INTEGER
- allocate memory not with Repli(Chr(0), nBytes) but with GlobalAlloc, like the following:

DECLARE INTEGER GlobalFree IN kernel32 INTEGER hMem
DECLARE INTEGER GlobalSize IN kernel32 INTEGER hMem

DECLARE INTEGER GlobalAlloc IN kernel32;
INTEGER wFlags, INTEGER dwBytes

LOCAL hMem, nSize
nSize = 26 * 1024 * 1024

hMem = GlobalAlloc(0, nSize)

? 'Handle to allocated memory:', hMem
? 'Bytes allocated:', GlobalSize(hMem)

* do not forget to release memory block
= GlobalFree(hMem)

* * *
Pass INTEGER hMem to your external function instead of that parameter you previously passed as STRING.

* * *
After an external function returns, find ways to parse allocated memory block or to copy its smaller parts to FoxPro strings. You can even use this handle hMem to store the content to a file. So many choices :)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform