On Apr 2, 2009, at 12:55 PM, Chris Swierczewski wrote: > Is there a way to overload or redirect from symbols in a compiled > library to a Cython function?
This is more of a C/fortran question than a Cython one (your cdef Cython functions are just plain C functions) and I believe the answer is "yes, but it can get messy." > I have a library containing several functions each, of course, with > their own corresponding symbol in the library symbol table. The main > function in the library internally calls each of the other auxiliary > functions within the library. I'm looking for some way to reroute one > of those function symbols to point to a custom Cython function, > essentially overriding whatever was contained in the library, so that > when the main function calls the function, foo(), it's the custom > Cython version and not the one contained in the library. > > The library in question contains compiled Fortran code from the > Clawpack (www.clawpack.org) software project. The code is meant to be > used directly to perform computations. That is, the main function > calls a collection of auxiliary Fortran subroutines. Initially, these > subroutines are empty. It's up to the user to write their own code to > define the behavior of the subroutine. > > If this is possible, it would probably the easiest way to my knowledge > to create a Cython wrapper of Clawpack. > > Thanks in advance for any help or ideas offered! So I understand you better, what you're trying to do is let the user provide their functions at runtime rather than at compile time? I think the easiest way to go about this would be to provide custom non- empty functions that call your code (e.g. via a function pointer the way callbacks work) rather than compiling empty stub functions and trying to overload the symbols at (load/run)time. - Robert --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---