Re: [julia-users] calling libraries of c++ or fortran90 code in Julia

2014-11-21 Thread Erik Schnetter
Ben

It could be that you need to leave out the leading underscore in the
ccall expression.

-erik

On Fri, Nov 21, 2014 at 10:13 AM, Ben Arthur bjarthu...@gmail.com wrote:
 i'm trying to use readelf and ccall as suggested for a C++ shared library,
 and get the following error. any ideas? thanks.


 $ readelf -sW /path/to/lib/libengine.so | grep resampler | grep init

 101: 3f10 832 FUNC LOCAL DEFAULT 11
 _ZL7initGPUP9resamplerPKjS2_j

 102: 4dc4 8 OBJECT LOCAL DEFAULT 13
 _ZZL7initGPUP9resamplerPKjS2_jE12__FUNCTION__



 julia
 dlopen(/path/to/lib/libengine.so,RTLD_LAZY|RTLD_DEEPBIND|RTLD_GLOBAL)

 Ptr{Void} @0x06fc9c40


 julia ccall((:_ZL7initGPUP9resamplerPKjS2_j, /path/to/lib/libengine.so),
 Int, (Ptr{Void},Ptr{Cuint},Ptr{Cuint},Cuint), arg1,arg2,arg3,arg4)

 ERROR: ccall: could not find function _ZL7initGPUP9resamplerPKjS2_j in
 library /path/to/lib/libengine.so


 in anonymous at no file


 julia ccall((:_ZZL7initGPUP9resamplerPKjS2_jE12__FUNCTION__,
 /path/to/lib/libengine.so), Int, (Ptr{Void},Ptr{Cuint},Ptr{Cuint},Cuint),
 arg1,arg2,arg3,arg4)

 ERROR: ccall: could not find function
 _ZZL7initGPUP9resamplerPKjS2_jE12__FUNCTION__ in library
 /path/to/lib/libengine.so

 in anonymous at no file



-- 
Erik Schnetter schnet...@cct.lsu.edu
http://www.perimeterinstitute.ca/personal/eschnetter/


Re: [julia-users] calling libraries of c++ or fortran90 code in Julia

2014-11-21 Thread Ben Arthur
i should've mentioned i had tried removing the underscore already.  didn't 
work.


Re: [julia-users] calling libraries of c++ or fortran90 code in Julia

2014-11-21 Thread Jeff Waller



*bizarro% echo __ZZL7initGPUP9resamplerPKjS2_jE12__FUNCTION__01 
|c++filt**initGPU(resampler*, 
unsigned int const*, unsigned int const*, unsigned int)::__FUNCTION__*

I'm not entirely sure what that even means (virtual table?), but you know 
what? I bet you compiled this with clang because when I do that same thing 
on Linux, it's like wa?. Because of that, and exceptions, and virtual 
table layout, and the standard calling for no standard ABI, I agree, can't 
you wrap all the things you want to export with extern C?


Re: [julia-users] calling libraries of c++ or fortran90 code in Julia

2014-11-21 Thread Erik Schnetter
This symbol is an object (maybe a lambda?) that is defined inside
another function (init_GPU). However, this isn't what Ben is trying to
call.

-erik

On Fri, Nov 21, 2014 at 10:59 AM, Jeff Waller truth...@gmail.com wrote:
 bizarro% echo __ZZL7initGPUP9resamplerPKjS2_jE12__FUNCTION__01 |c++filt
 initGPU(resampler*, unsigned int const*, unsigned int const*, unsigned
 int)::__FUNCTION__


 I'm not entirely sure what that even means (virtual table?), but you know
 what? I bet you compiled this with clang because when I do that same thing
 on Linux, it's like wa?. Because of that, and exceptions, and virtual
 table layout, and the standard calling for no standard ABI, I agree, can't
 you wrap all the things you want to export with extern C?



-- 
Erik Schnetter schnet...@cct.lsu.edu
http://www.perimeterinstitute.ca/personal/eschnetter/


Re: [julia-users] calling libraries of c++ or fortran90 code in Julia

2014-11-21 Thread Jeff Waller
Oh yea.  I cut-n-pasted the wrong line, well I'll just fix that and 


*echo __ZL7initGPUP9resamplerPKjS2_j|c++filt**initGPU(resampler*, unsigned 
int const*, unsigned int const*, unsigned int)*

different symbol same comment.  


but if it has to be this way, hmm  FUNC LOCAL DEFAULT --- that function 
isn't declared static is it?  


Re: [julia-users] calling libraries of c++ or fortran90 code in Julia

2014-11-21 Thread Ben Arthur
there might be a way to fix this, but since i'm in a hurry, i decided to 
just modify the C++ so as to avoid mangling.  thanks for the help.