Hi Hui -

You have some options. Since (I think) you're using LLVM anyway,
you can use extern blocks - there you would just #include the
right header from Chapel.

See http://chapel.cray.com/docs/latest/technotes/extern.html

Using the path you started down though, I think the missing
piece is just that you need to provide the .h file that you
would include (that defines ProfilerStart etc) on the
chpl command line. Or you can provide a .h file that
#includes that one.

-michael

On 10/20/15, 4:48 PM, "Hui Zhang" <[email protected]> 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