This is a c++ DLL question.

Asked 2 years ago, Updated 2 years ago, 20 views

This is my first time to create a DLL, so I have a question.

The function I'm trying to make into a DLL is a function that takes another DLL and uses it, but if I make it into a DLL, can I bring additional settings into the DLL and use it anywhere else?

Also, should I write the external "C" __declspec(dllexport) for the internal function used in the function?

Please reply. (__)

c++

2022-09-22 12:00

1 Answers

__declspec(dllexport) is only required for functions that are externally exposed.

You can just do the internal functions, but... Such functions can also be prevented from being exposed through the header file so that library users are not confused.

In addition, since the DSO and DLL of the ELF family differ in ABI[2] through cross-compilation, the corresponding __declspec(dllexport) may fail at the GNUC compilation level [1]. In this case, #define is often used to solve this problem [3]. For GNUC, the default declaration is export.

And if you export a function through dllexport or _attribute__, Linux can view the symbol table with the nm command, so if it becomes a security issue, you can hide it with ____attribute_((((visibility("hidden")

If you need anything else, please leave a comment.

References


2022-09-22 12:00

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.