+1 On Fri, Mar 30, 2012 at 1:53 AM, Roger Brobst <rogerb@cadence.com> wrote:
Referring to the drmaa2 C binding header at http://bit.ly/zwgDFP I see:
typedef void * drmaa2_jsession_h; typedef void * drmaa2_rsession_h; typedef void * drmaa2_msession_h; typedef void * drmaa2_j_h; typedef void * drmaa2_jarray_h; typedef void * drmaa2_r_h;
whereas, I expected something more like:
struct drmaa2_jsession_s; /*forward*/ struct drmaa2_rsession_s; /*forward*/ struct drmaa2_msession_s; /*forward*/ struct drmaa2_j_s; /*forward*/ struct drmaa2_jarray_s; /*forward*/ struct drmaa2_r_s; /*forward*/
typedef struct drmaa2_jsession_s * drmaa2_jsession_h; typedef struct drmaa2_rsession_s * drmaa2_rsession_h; typedef struct drmaa2_msession_s * drmaa2_msession_h; typedef struct drmaa2_j_s * drmaa2_j_h; typedef struct drmaa2_jarray_s * drmaa2_jarray_h; typedef struct drmaa2_r_s * drmaa2_r_h;
A problem with using, typedef void * drmaa2_jsession_h; in a C binding is that any pointer type can be passed to a function declared like: extern void myFavoriteFunction( drmaa2_jsession_h firstArg ); since it effectively accepts a 'void *'.
For example:
/*start-of-file mymain.c*/ #ifdef CURRENT typedef void * drmaa2_jsession_h; #else struct drmaa2_jsession_s; /*forward*/ typedef struct drmaa2_jsession_s * drmaa2_jsession_h; #endif
extern void myFavoriteFunction( drmaa2_jsession_h firstArg );
int main( int argc, char* argv[] ) { myFavoriteFunction( &argc ); return 0; } /*end-of-file mymain.c*/
$ gcc -c -DCURRENT mymain.c $ gcc -c -DCURRENT -Wall -pedantic mymain.c $ gcc -c -UCURRENT mymain.c mymain.c: In function ?main?: mymain.c:13: warning: passing argument 1 of ?myFavoriteFunction? from incompatible pointer type $ gcc --version gcc (GCC) 4.1.2
-------- Original Message -------- Subject: [DRMAA-WG] OGF34 summary From: Peter Tröger <peter@troeger.eu> To: drmaa-wg@ogf.org <drmaa-wg@ogf.org> Cc: Thijs Metsch <thijs.metsch@de.ibm.com>, "alexander.papaspyrou@tu-dortmund.de" <alexander.papaspyrou@tu-dortmund.de>, AndrewX Edmonds <andrewx.edmonds@intel.com> Date: 03/16/2012 12:54 AM
Dear all,
as announced, I spent two days at OGF 34 in Oxford. Here is the short summary from DRMAA perspective:
1.) C Binding
Andre Merzky and me spend some minutes on fixing the final issues in the C binding header file. As before, the latest version is here:
We did another round of re-naming to get the method names even shorter. The list iterator is now more array-alike.
Since I get frequent requests for the final header file, I will start the document preparation during the next days. If you want to influence the C layout of DRMAAv2, this is your last chance.
[ ... DELETED TEXT ... ]
-- drmaa-wg mailing list drmaa-wg@ogf.org https://www.ogf.org/mailman/listinfo/drmaa-wg
-- Nothing is ever easy...