Hello --

I believe you can solve this problem by putting C-style declarations for
ProfilerStart() and ProfilerStop() in a .h file (prof-decls.h, say) and
then adding that .h file to the chpl command line:

  chpl -g myCode.chpl prof-decls.h -I../include/ -o myCode -L../lib -ltest

(Sorry I didn't yet respond to your earlier message.  I needed time to
dig into the cause of the problem, but had not found that time yet.)

greg


On Tue, 20 Oct 2015, Hui Zhang wrote:

Hello,

I'm trying to use gperftools to profile the Chapel code, but simply link
the profiler library doesn't produce the profile file, so I need to
explicitly call two external C functions within my Chapel code, here's
what I did:

1. in my chapel module:
        extern proc ProfilerStart(name: c_string);
             **it suggested me to use c_string instead of string
        exetern proc ProfilerStop();
    then in proc main, I called this two functions
2. recompile my chapel program:
         chpl -g myCode.chpl -I../include/ -o myCode -L../lib -ltest

But I got this error :
/_main.c:30:0:
/Hui.c: In function ‘chpl_user_main’:
/Hui.c:160:1: error: implicit declaration of function ‘ProfilerStart’
[-Werror=implicit-function-declaration]
/Hui.c:160:1: error: nested extern declaration of ‘ProfilerStart’
[-Werror=nested-externs]
/Hui.c:163:1: error: implicit declaration of function ‘ProfilerStop’
[-Werror=implicit-function-declaration]
/Hui.c:163:1: error: nested extern declaration of ‘ProfilerStop’
[-Werror=nested-externs]
cc1: all warnings being treated as errors
make: *** [/tmp/chpl-hzhang86-15966.deleteme/experiment.work.funh.tmp]
Error 1
error: compiling generated source [mysystem.cpp:43]

Should I just ignore these warnings ? but how to disable this warning as
error option?
Or am I doing it wrong ?

Thanks

--
Best regards


Hui Zhang

------------------------------------------------------------------------------
_______________________________________________
Chapel-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-developers

Reply via email to