Same Thirdparty source code twice in a application.

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
BaT_3785171
Level 2
Level 2
First like given

I have installed WICED-Studio-6.2.1.2-IDE.
I am porting a source code to 43xxx_Wi-Fi project.
Source code which i am porting is already having customized LwIP 2.1.2
In WICED folder also customized LwIP 2.0.3 is present.

I understand from my previous question (with title Upgradation of LwIP to 2.1.2)
in this community that combining these two customized LwIPs is not a recommended
solution.

I have decided to keep both the LwIPs.
1.Idea is not to touch LwIP in source code being ported.(As source code not to be changed).
2.And LwIP present In WICED folder to be compiled using 'namespace' after changing all the required
  files to .cpp extension.
 
My concern is with pre-processor directives.
When i search for "#define " directive i am getting 3781 hits in 222 files of WICED LwIP 2.0.3.
These pre-processor macros which may be common in both LwIPs(application LwIP 2.1.2 and WICED LwIP 2.0.3) may either
cause compilation error or runtime error.

Any idea to handle this kind of situation?

0 Likes
3 Replies
GauravS_31
Moderator
Moderator
Moderator
10 questions asked 250 solutions authored 250 sign-ins

You can consider using #ifdef with a macro that would identify the LWIP version. The macros which are not needed would be greyed out.

0 Likes

I hope you got my question that i am trying to compile both LwIPs in my project at same time.

I am thinking of renaming pre-processor directives in WICED LwIP  2.0.3 so that no clash happens with LwIP 2.1.2  macros.

My concern is about the 'Number' of macros present.

It seems not a good way to rename 3781 macros present in LwIP 2.0.3.

Any better idea can you suggest?

0 Likes

We recommend that only the upgraded LwIP version should be kept because other than redefining the macros, there is no other solution to this issue. The 3781 macros can be used again by WICED without worrying about redefining them. Only the LwIP macros, functions, structures used by WICED but not defined by upgraded LwIP need to be changed.