How can I avoid conflicting function names in two different static libs. when using MATLAB Coder?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I use the fopen fclose functions in my MATLAB code int wo different project (two static libs). The generated code includes different implementations of these function (cfclose cfopen) but use the same name. This becomes a problem for the linker when using the two libraries in my main application.
How can a control the namegiving of the functions when I code generate?
0 comentarios
Respuestas (1)
Infinite_king
el 1 de Dic. de 2023
Editada: Infinite_king
el 1 de Dic. de 2023
Hi Christer Nykvist,
I understand that you are trying to use multiple static libraries which has been generated using MATLAB Coder.
The default Code generation configuration will generate the code without using namespaces. We can instruct the MATLAB Coder to generate the code in such a way that it places all the generated functions in a specific namespace. We can use this feature to place the functions generated by MATLAB Coder in different projects in their own respective namespaces. This will resolve any naming conflicts.
To use namespaces, set the following configuration parameters as follows,
% Project 1 configuration
cfg = coder.config('lib'); % choose required target
cfg.TargetLang = "C++";
cfg.CppNamespace = 'namespace1'; % Namespace name
% Project 2 configuration
cfg2 = coder.config('lib'); % choose required target
cfg2.TargetLang = "C++";
cfg2.CppNamespace = 'namespace2'; % Namespace name
For more information on how to integrate multiple libraries generated by MATLAB Coder, refer the following MATLAB documentation.
Hope this is helpful.
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!