Opened 5 years ago

#1502 new enhancement

provide equivalent of CCTK_PASS_CTOC and CCTK_PASS_FTOF between languages

Reported by: Roland Haas Owned by:
Priority: minor Milestone:
Component: Cactus Version: development version
Keywords: Cc:


It is occasionally (such as when interfacing with legacy code) code useful to use the equivalent of CCTK_PASS_CTOF and CCTK_PASS_FTOC.

This seems to be impossible to directly. Workarounds are declare the C function to take cGH ** p_cctkGH as an argument then set up a local cGH *cctkGH = *p_cctkGH before DECLARE_CCTK_ARGUMENTS for CCTK_PASS_FTOC while for CCTK_PASS_CTOF one seems to have to resort to CCTK_FortranWrapper and call the returned wrapper with cctkGH and the (Fortran) function pointer.

Note: this of course suffers from combinatorial explosion of options when Cactus starts to support Lua/Python/Tcl/Java/Forth.
It might be useful to instead provide a set of functions that allow this to be done "officially". Something like:

  call CCTK_PASSFTOC(Cfunc)



where the later is essentially

#define CCTK_PASSCTOF(fun) (CCTK_FortranWrapper(CCTK_THORNSTRING))(fun, cctkGH)

and the former

#define CCTK_PASSFTOC(fun) CCTK_PassFtoC(fun, cctkGH)
void CCTK_FNAME(CCTK_PassFtoC)(void (*f)(cGH *cctkGH), cGH **p_cctkGH)

Attachments (0)

Change History (0)

Modify Ticket

Change Properties
Set your email in Preferences
as new The ticket will remain with no owner.
Next status will be 'review'.
as The resolution will be set.
to The owner will be changed from (none) to the specified user.
Next status will be 'confirmed'.
The owner will be changed from (none) to anonymous.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.