calling a function in a static library

Sysprogs forums Forums VisualGDB calling a function in a static library

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #10351
    Frank
    Participant

    Hello,

    I was trying to call a few functions from librtc.a temprature_sens_read() and hall_sens_read().
    But it seems the file doesn’t get linked.

    linker command

    I tried adding librtc.a in additional linker inputs with the absolute path. it only accepted it within quotes and it didn’t help.

    I believe the library is included since -lrtc and -L../../../../../../SysGCC/esp32/esp32-bsp/esp-idf/components/esp32/lib are included in the command

    I succeeded in calling these functions when building esp-idf on my linux machine. I know those functions are there, how do I call them.

    Thanks,

    Frank

    #10366
    support
    Keymaster

    Hi,

    Please try enabling verbose mode for the linker via VS Project Properties -> Linker -> Advanced. This should produce a massive debug output showing ALL the libraries checked by the linker. If librtc.a is on the list, but the problem still occurs, please try running the <target>-nm tool on the library to get a list of all symbols in it and double-check that this version of the library actually contains that symbol.

    #10388
    Frank
    Participant

    I’ve turned on verbose mode for the linker. BuildLinkerOut

    1> attempt to open ../../../../../../SysGCC/esp32/esp32-bsp/esp-idf/components/esp32/lib\librtc.a succeeded
    1> (../../../../../../SysGCC/esp32/esp32-bsp/esp-idf/components/esp32/lib\librtc.a)bt_bb.o
    1> (../../../../../../SysGCC/esp32/esp32-bsp/esp-idf/components/esp32/lib\librtc.a)pm.o
    1> (../../../../../../SysGCC/esp32/esp32-bsp/esp-idf/components/esp32/lib\librtc.a)rtc_analog.o
    1> (../../../../../../SysGCC/esp32/esp32-bsp/esp-idf/components/esp32/lib\librtc.a)rtc.o
    1> (../../../../../../SysGCC/esp32/esp32-bsp/esp-idf/components/esp32/lib\librtc.a)rtc_clk.o
    1> (../../../../../../SysGCC/esp32/esp32-bsp/esp-idf/components/esp32/lib\librtc.a)rtc_cntl.o
    1> (../../../../../../SysGCC/esp32/esp32-bsp/esp-idf/components/esp32/lib\librtc.a)rtc_command.o

    I’ve run the nm.exe nm output Line 102 contains the function I’d like to call.

    00000040 T temprature_sens_read

    From rtc_analog.o:

    #10394
    support
    Keymaster

    Hi,

    Based on the log snippet you attached, this should work. Perhaps it is an extern “C” problem?

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.