I think it's complaining about ProfilerStop(), perhaps that you need:
  void ProfilerStop(void);

to make it a complete prototype by saying explicitly that it takes no
arguments?

greg


On Tue, 20 Oct 2015, Hui Zhang wrote:

Hello, Greg

So I create a prof-decls.h and put these two lines in it:
int ProfilerStart(const char* fname);
void ProfilerStop();
which I get from the gperftools/profiler.h
chpl -g myCode.chpl prof-decls.h -I../include/ -o myCode -L../lib -ltest
it reports less errors but still this one:

In file included from /chpl__header.h:5:0,
                 from /_main.c:1:
              ./prof-decls.h:2:1: error: function declaration isn’t a
prototype [-Werror=strict-                  prototypes]

why the ProfilerStart declaration isn't the function prototype ?
Thanks


On Tue, Oct 20, 2015 at 5:07 PM, Greg Titus <[email protected]> wrote:
      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




--
Best regards


Hui Zhang

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

Reply via email to