I will clearly explain our present software structure in solaris and how the exporting/importing will takes place.
It consists of hundreds of modules and programs written in C and Pascal ,functions interaction will be in below combinations a) C functions defined in C Programs will be called from Pascal Modules and Programs b) Pascal functions defined in One Pascal module will be called from other Pascal Modules and Programs
I)PASCAL MODULE STRUCTURE
a)MODULE XXXX /* module name xxxx */
b)INCLUDE FILES /* they will contain user defined data types and macros, these files are standard incluide files for all our modules*/
c)IMPORTING INCLUDE FILES
/*these files will contain the functions to be imported from the other module */ /* C-functions will be called like below FUNCTION set_bit(mask : INTEGER; bit_position : INTEGER): INTEGER; EXTERNAL C; Actually the above function is defined pas_c.c file.pas_c.c is compiled to pas_c.o and linked to the modules which will use the functions defined in pas_c.c.
/* Pascal-functions will be called from other Pascal modules like below FUNCTION mininteger(First, Second: INTEGER): INTEGER; EXTERN; Actually the above function is defined pasmath.pas file. pasmath.pas is compiled to pasmath.o and linked to the modules which will use the functions defined in pasmath.pas.But the function definition of the FUNCTION mininteger(First, Second: INTEGER): INTEGER; in pasmath.pas should be prceeded by the keyword 'PUBLIC' so that other modules can use this.
d)BODY OF THE MODULE /* Main Code Part */
II)C PROGRAM STRUCTURE
a)STANDARD HEADER FILES /*stdio.h*/
b)INCLUDE FILES /* they will contain user defined data types and macros */
c)FUNCTION PROTOTYPES
d)FUNCTION DEFINITIONS
Hope, I have explained clearly.
with the sun pascal and c compilers we donot need to have export clause explicitly.linking will take care of it automatically when one function from a module is called in another module/program.Using EXTERN and EXTERN C keywords we can specify the compilers that the functions are not defined in the current module but in the linked modules.
My request is what should i do to compile this code using GNU compilers without doing major modifications in my present structure.
Regards Hari
__________________________________ Start your day with Yahoo! - Make it your home page! http://www.yahoo.com/r/hs