Nanopb now (partly) in dynamically linked system service. How can I use it in user space without linker conflicts?

I was using nanopb in my project, but in the develop branch nanopb was added in the dynalib services. These are compiled into the system layer on the photon.

The nanopb functions are exported here as a dynamically linked library:

I was using pb_decode_delimited_noinit and pb_encode_delimited, two functions that are part of nanopb, but not in Particles dynalib.

This leaves me stuck:

  • I cannot include pb_encode.c and pb_decode.c in my user code build because I will have multiple definitions at link time of the functions that ARE in dynalib.
  • I cannot omit the c files, because then I will have undefined references to pb_decode_delimited_noinit and pb_encode_delimited.

I think the correct solution would be for Particle to make all the nanopb functions available for linking. Maybe some dynamically linked and others linked into user app space if they are used.

How would I do that myself until Particle fixes this issue?

My code can build if I build with MODULAR=n, but then WiFi doesn’t connect and it hard faults with buffer overflow when going through WiFi setup in the phone app. This is on the WiFi/TCP fixes (PR #1500).

So yeah… I’m stuck. I’m doing everything I can to provide information for Particle to fix bugs in the framework but I keep hitting wall after wall.

I have created a GitHub issue here:

Let me ping someone that might be able to help, @rickkas7 or @ParticleD are you able to assist?