Say the shared library contains the following lines:
const char* const arr[] = { "one", "two", "three" };
1) Can the application reference this library and use the symbol "arr"?
2) Is binary compatibility broken if a new element is added to the definition?
3) How about whether one of the string literals has changed?
4) Why (not)?
Cheers, Luke
1) Yes
2) No
3) Not a problem
4) Why do you think otherwise?
In both cases, binary compatibility is not interrupted.
C , .
, .
arr , . , arr .
arr, : , , .
NULL, :
const size_t arrSize = sizeof(arr)/sizeof(char*);
1) , , extern ( , const , , -;)).
extern
const
2) , arr , . , , arr NULL-terminated, extern const unsigned arr_size = sizeof(arr) / sizeof(arr[0]).
arr
extern const unsigned arr_size = sizeof(arr) / sizeof(arr[0])
3) . ; , .
4) , arr , .
Source: https://habr.com/ru/post/1726536/More articles:What a good project is for learning the power of Unix / Linux - c ++Микширование частей MEF, нацеленных на .NET 3.5 с помощью приложения, предназначенного для .NET 4.0 - .netЧто такое thread? Как создать поток в приложении win32? - winapiasp.net mvc serving txt is truncated - asp.net-mvcclustering library? - text-processingUnix filter "wrap" - unixpointer assignment - c ++.Net Is it better to check the updated AssemblyInfo.cs assembly in daily assembly? - version-controlVisual Studio 2008 Force Debugger to Execute an Executable File - debuggingDiv над iframe, которое из самого iframe - htmlAll Articles