If you use .cpp the compiler decides to compile it as C++ and so uses name-mangling (https://en.wikipedia.org/wiki/Name_mangling#C.2B.2B). If you want to compile as C++ but have ccall'able signatures, put an `extern "C" { ... }` around the C entrypoints.
FYI: you can debug this kind of question by using `nm` to see the list of exports (on linux and mac, there are similar tools on windows). On Wed, Jul 13, 2016 at 8:14 AM, Guillaume <zahar.guilla...@gmail.com> wrote: > Hi ! > > I'm trying to implement an interface between Julia and a program > developping in C++. For that I would like to use ccall from Julia to call C > functions which call C++ functions of my program in a shared library. When > I create a shared library from a file.c it works but when I create a shared > library with the same function in a file.cpp and call it from Julia I've > got this error : > *ERROR: ccall: could not find function hello in library libtest* > * in anonymous at no file* > > I really don't understand why the simple fact to name my file "file.cpp" > instead of "file.c" change something. In both case I generate a "file.o" > with -fPIC option and put it in a shared library... Can someone explain me > the reason please? > > Guillaume > >