|
Lim Hock-Chai wrote: > > Thanks Barbara. > > Do you mind explain why it wouldn't work when parm is defined to pass by > value? > 1. The doc only say to pass by char pointer. In my CLLE program I pass the > variable &BBCD by reference, which match what the doc ask for. > > My guess is that because it is define to pass by value, the caller is > resposible to move the value of the passing parm to the parm memory address > in the procedure. Since CL doesn't know to do that, it wouldn't work. > The CLLE doesn't have to do anything special to call the API. The API is called the same way whether the final called procedure has the parameter passed by value or passed by reference. The API always gets pointers for the procedure's parameters. In the special case where you say that the procedure is expecting an integer passed by value, the API will dereference the pointer as an integer and pass the integer value. But there's no way to tell the API to dereference the pointer as any other type. When you pass a parameter by reference, it is the same as passing the address of the parameter by value; either way you just pass a pointer to the parameter. All pointers look the same to the system; it doesn't matter to the system what type the pointer is pointing to. But when you pass a parameter by value, you must pass the exact type. When the API calls your procedure it passes all the parameters by value, but it only supports two types of parameter: pointer and integer. It has no way to pass any other type by value because it doesn't have any way of knowing the exact type to pass.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.