Re: [ooc-compiler] Interfacing OOC to Gnu Scientific Library
Brought to you by:
mva
|
From: Michael v. A. <mi...@de...> - 2002-02-04 10:41:36
|
Stewart Greenhill <sgr...@ip...> writes: > [...] > 2) GSL makes quite frequent use of C's ability to pass / return structures > by value. I did a rough calculation and it appears that of 3500 functions, > approximately 500 are affected in this way. This includes all complex math > functions, some BLAS functions (eg. passing complex constants by value), and > various fuctions related to the use of views of vectors and matrices. > > In the translated interface the affected functions are annotated "Function > returns RECORD", or "Function has RECORD parameter" (or both) so searching > for "Function" will show you which ones are involved. > > It would be useful to be able to pass C records by value to and from C > functions. I suspect that this is probably not too hard to acheive, although > I have not looked at the details. Michael, how easy is this to do? I'm not > suggesting that the feature be used within Oberon-2, just as a way of > interfacing to C. It would only need to work with records declared in > interface modules. There are two issues here: Handling of "struct" values that are passed to parameters, and structured return values (returning a "struct" from a function). The former needs a flag for interface module (probably a module global flag for INTERFACE), changes to the code that emits procedure headers (interpreting the flag), and the code that produces values that are passed to these arguments. All in all, this seems to be pretty straightforward. The second issue is more of a problem. With OOC1, returning a structured value from a function is not anticipated. Changing this could be a major piece of work. All in all: these two changes required lots of work ;-) -- mva |