[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[open-cobol-list] Getting LINKAGE SECTION information from C at runtime?
From: |
David Lee Lambert |
Subject: |
[open-cobol-list] Getting LINKAGE SECTION information from C at runtime? |
Date: |
Fri, 05 Oct 2012 07:14:40 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:14.0) Gecko/20120714 Thunderbird/14.0 |
Hello,
I'm playing with OpenCobol and trying to build a simple, generic shim
between it and a certain strongly-typed, object-oriented,
bytecode-compiled language. The functions "cob_init" and "cob_resolve"
look like most of what I need, and then I'll use libffi or another
similar library to actually invoke the function-pointer.
However, I'm not quite sure how to handle function arguments. It looks
like a procedure compiled by open-cobol will always take zero or more
"char*" arguments, how many depending on how many parameters are in the
LINKAGE SECTION. However, each pointer could be alphanumeric or numeric,
edited or not, signed or not, packed or not, fixed-point if numeric, or
in native (COMP-5) form; and a PIC SN COMP-5 parameter could be one,
two or four bytes depending on compiler options.
I see two alternatives:
1. Have the user of my library pass in a complete specification of the
types of all arguments when first requesting the function, either using
constructors/ constants/factories I provide for that purpose or as
strings of COBOL source text
2. Look up the types of the arguments (the "size" member of struct
cob_field and all members of struct cob_field_attr) at runtime.
Option (2) seems easier; but does OpenCOBOL (and I'm trying to be
compatible with both 1.0 and 1.1) compile that information into a
globally-visible symbol? Or is it retrievable at runtime after the
function has been resolved?
--
David L. Lambert <address@hidden> or <address@hidden>
or <address@hidden>, formerly "address@hidden"
IM: davidleelambert (Yahoo!) or address@hidden (MSN)
Phone: 616-676-7375
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [open-cobol-list] Getting LINKAGE SECTION information from C at runtime?,
David Lee Lambert <=