[LLVMdev] Call in-library only class member

Sebastian Dreßler dressler at zib.de
Sun May 27 10:47:07 PDT 2012


Hi,

I'm trying to call class members which are not used within the original 
source code and therefore are not declared within bitcode. An example 
would be calling std::vector<T>::size(). Right now I'm using a helper 
function, e.g.

int f(vector<int> &v) {
     return (int)v.size();
}

However, this solution is not as elegant as I would like it to have, 
mostly due to the fact that with changing T i have to provide additional 
code. So I wondered whether it is possible to declare a function and 
recompile the resulting bitcode again with the result that the correct 
function of the object gets called.

 From what I can see from [1] Kenneth Uildriks mentions JIT and also 
that a declaration can be included. But I'm unable to link this proposed 
solution to my actual problem.

Thanks,
Sebastian


[1]: How can we call an object's virtual function inside IR? 
http://groups.google.com/group/llvm-dev/browse_thread/thread/426dc51e1edb33e0/2c238292d16512ff?lnk=gst&q=call+object#2c238292d16512ff

-- 
Mit freundlichen Grüßen / Kind regards

Sebastian Dreßler

Zuse Institute Berlin (ZIB)
Takustraße 7
D-14195 Berlin-Dahlem
Germany

dressler at zib.de
Phone: +49 30 84185-261

http://www.zib.de/



More information about the llvm-dev mailing list