search for: item_iterator

Displaying 5 results from an estimated 5 matches for "item_iterator".

2012 Mar 15
3
[LLVMdev] Using JIT code to code a program to call C++
My project has a C++ library that I want to allow the user to use via some programming language to be JIT'd to call functions in said library. For the sake of simplicity, assume the library has classes like: class item { public: item(); item( int ); ~item(); // ... }; class item_iterator { public: virtual ~item_iterator(); virtual bool next( item *result ) = 0; }; class singleton_iterator : public item_iterator { public: singleton_iterator( item const &i ); // ... }; I'm aware that LLVM doesn't know anything about C++ and that one way to call C++ func...
2012 Mar 21
1
[LLVMdev] Catching C++ exceptions, cleaning up, rethrowing
To recap, on Mar 14, 2012, I wrote: > My project has a C++ library that I want to allow the user to use via some programming language to be JIT'd to call functions in said library. For the sake of simplicity, assume the library has classes like: > > class item_iterator { > public: > virtual ~item_iterator(); > virtual bool next( item *result ) = 0; > }; > > I'm aware that LLVM doesn't know anything about C++ and that one way to call C++ functions is to wrap them in C thunks: > > extern "C" bool thunk_iterator_M...
2012 Mar 22
1
[LLVMdev] Catching C++ exceptions, cleaning up, rethrowing
...te: > To recap, on Mar 14, 2012, I wrote: > >> My project has a C++ library that I want to allow the user to use via some programming language to be JIT'd to call functions in said library. For the sake of simplicity, assume the library has classes like: >> >> class item_iterator { >> public: >> virtual ~item_iterator(); >> virtual bool next( item *result ) = 0; >> }; >> >> I'm aware that LLVM doesn't know anything about C++ and that one way to call C++ functions is to wrap them in C thunks: >> >> extern &qu...
2012 Mar 22
0
[LLVMdev] Catching C++ exceptions, cleaning up, rethrowing
...ent from what I proposed (putting the try/catch in the thunks)? (Ideally, I want to minimize layers of function calls.) Again for reference: extern "C" bool thunk_iterator_M_next( void *v_that, void *v_result, dtor_pairs *dtors ) { try { item_iterator *const that = static_cast<item_iterator*>( v_that ); item *const result = static_cast<item*>( v_result ); return that->next( result ); } catch ( ... ) { run_dtors( dtors ); throw; } } - Paul
2012 Mar 23
2
[LLVMdev] Catching C++ exceptions, cleaning up, rethrowing
...n it should run the d'tors for you. There's no reason for you to have a "run_dtors" function there. -bw > extern "C" bool thunk_iterator_M_next( void *v_that, void *v_result, > dtor_pairs *dtors ) { > try { > item_iterator *const that = static_cast<item_iterator*>( v_that ); > item *const result = static_cast<item*>( v_result ); > return that->next( result ); > } > catch ( ... ) { > run_dtors( dtors ); > throw; > } > } > > - Paul >