Creating a static-lib project I want to use the GCC flag: fvisibility=hidden
Adding this to the compiler flags it is not working.
Many thanks in advance for helpful tips!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-10-12 6:42 AM
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-10-18 5:22 PM
You're making a static library (.a), not a .so. Visibility of publics applies only to exports of shared libraries.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-10-14 3:32 AM
Hello @OBorg.1​
First let me thank you for posting.
I am trying to investigate this issue and it would be very helpful if you provide me with:
- What are you trying to achieve and why?
- Could you let us know the rest of the compiler linker settings?
I will be waiting for your feedback.
Kind regards,
Semer.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-10-14 3:46 AM
Here are the other GCC settings:
-mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32G431xx -c -I../Drivers/CMSIS/Device/ST/STM32G4xx/Include -I../Drivers/CMSIS/Include -I../Inc -I../Drivers/STM32G4xx_HAL_Driver/Inc -I../Drivers/STM32G4xx_HAL_Driver/Inc/Legacy -I"C:\Users\TE228673\SW_Dev\STM32CubeIDE\workspace_1.7.0\KMX-D\DESIGN_DEMOS\PRIVATE_INCLUDE_FILE_TEST_LIB\Module\PrivateLogicFunctions\Inc" -I"C:\Users\TE228673\SW_Dev\STM32CubeIDE\workspace_1.7.0\KMX-D\DESIGN_DEMOS\PRIVATE_INCLUDE_FILE_TEST_LIB\Module\PublicLogicFunctions\Inc" -O0 -ffunction-sections -fdata-sections -Wall -fvisibility=hidden -v -fstack-usage --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb
I am creating a static-lib project.
This project contains a lot of functions for internal use only. These functions MUST NOT be callable from outside the static lib.
Referring the: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options
This can usually be achieved by simply using the GCC flag:
-fvisibility=hidden
Unfortunately, this flag does not work in my project in CubeIde.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-10-18 7:12 AM
Hello,
Unfortunately I still haven't found a solution to my problem.
I am looking for a solution in CubeIDE for the following situation:
I need to create a library which:
* implemented some functions that need to be callable from outside
* numerous functions implemented that must NOT be accessible from outside
I have to integrate this library later in an executable project.
How can I achieve this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-10-18 5:22 PM
You're making a static library (.a), not a .so. Visibility of publics applies only to exports of shared libraries.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-10-18 10:04 PM
Hello Pavel,
Many thanks for the explanations.
How is a requirement like mine implemented?
(This should be a common use case.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-10-18 10:17 PM
Maybe some more background information will help:
The code (several libraries) that I create should later be used in various executable MCU projects (by other developers) in the simplest possible way.
In order to prevent manipulation of the code, the actual C code must not be distributed.
(Hence my idea to use .a file(s))
