Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » 4DIAC - Framework for Distributed Industrial Automation and Control » Forte as Static Library(Forte as Static Library)
Forte as Static Library [message #1747439] Mon, 14 November 2016 17:43 Go to next message
yuvaraj velumani is currently offline yuvaraj velumaniFriend
Messages: 15
Registered: April 2016
Junior Member
I need to use Forte as Static Library. I have modified CMakeLists.txt file to STATIC_LIBRARY and build it. I have linked the library (VS2015) and included the forteinit.cpp/.h and stringlist.cpp/.h file. But it says it cannot open "stringdict.h" and "fortealloc.h". Is there a document or "how to" that says how to use this static library and create my own runtime application?

Will this runtime application can be used along with 4Diac?
Re: Forte as Static Library [message #1747446 is a reply to message #1747439] Mon, 14 November 2016 19:56 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1585
Registered: January 2014
Senior Member

Unfortunately there is not much documentation on using 4diac as library. The cpp files you mention are already part of the generated static library and to my knowledge you only need to put the call forteInit::initForte() into your code. However I noticed that the main FORTE is using will be part of the static lib. So this is also something you may not want.

This depends a bit on your use case. Could you be so kind and take a bit more what you would like to do? Maybe there is a better option in FORTE or if not we can better understand to adjust FORTE to your needs.

Alois
Re: Forte as Static Library [message #1747508 is a reply to message #1747446] Tue, 15 November 2016 14:55 Go to previous messageGo to next message
yuvaraj velumani is currently offline yuvaraj velumaniFriend
Messages: 15
Registered: April 2016
Junior Member
Thanks for your reply. Well I am just trying to create a function block to implement a PID algorithm. As I am not familiar with Structure Text and wanted to implement a simple C++ code. Also I do not wanted to see the huge FORTE code base in my VS2015 project. I thought keeping FORTE as library will provide me more sufficient way of writing my own algorithm and play with it.
I have chosen only few specs during the CMake configuration. should I need to select more?
FORTE_ARCHITECTURE Win32, FORTE_BOOTFILELINEBUFSIZE 300, Checked FORTE_COM_ETH and FORTE_COM_FBDK, rest all options unchecked. I am using the latest 4diac-RTE 1.8.1 version source code.
forte project property -> Runtime Library -> Multi - thread (/MT). Configuration -> Release
Re: Forte as Static Library [message #1747528 is a reply to message #1747508] Tue, 15 November 2016 16:27 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1585
Registered: January 2014
Senior Member

Hi thanks for the clarification. In this case I would strongly recomend to not build a library but build FORTE as normal executable. This will also allow you to add your own C++ code. However in order to make it usable in your applicaiotns you need to develop a FB first generate C++ code for it and change the C++ code to your needs. Please have a look on the FB develoment tutorials there you should find a descriptions how to do it. For simple FBs I can also recomend to look at Structured text. It may make your developments in the future much easier.

Regarding your options I would also turn on the Modules (FORTE_MOdULE_xxx): CONVERT, IEC6131-3, and UTILs. And when following the descriptions in the FB development tutorials your own modules. Modules are the FORTE means to extend FORTE with own code.

I hope this helps you to get 4diac working for you needs. If not I'm happy to support you.

BR,
Alois
Re: Forte as Static Library [message #1747534 is a reply to message #1747528] Tue, 15 November 2016 17:24 Go to previous messageGo to next message
yuvaraj velumani is currently offline yuvaraj velumaniFriend
Messages: 15
Registered: April 2016
Junior Member
Hi Thanks a lot for your detailing and helping me with a solution. I will use your idea for now.
But is there a clean way to use FORTE as static library/shared library and create user application?
I would appreciate if you could help me with such options.
Re: Forte as Static Library [message #1747551 is a reply to message #1747534] Tue, 15 November 2016 21:07 Go to previous message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1585
Registered: January 2014
Senior Member

I think you can get the most out of it going with the FORTE as application option. This is also the main way we develop FORTE. Using it as library are AFAIK some very special cases where FORTE gets integrated in some other application framework. Currently I think this requires some manual tinkering with teh FORTE code. Especially how we are starting FORTE. For this it could be an interesting idea to offer a method startFORTE and not a int main() function as we are doing now.

For other use-cases like added external/existing C/C++ code or existing libraries the way to go is to wrap it in Function Blocks and add them to FORTE as module. We do this for example with MQTT, OPC UA or EthernetPowerlink support. Given your description I think this is also the way I would recommend for you.
Previous Topic:Broken download link?
Next Topic:4DIAC IDE - BB GPIO
Goto Forum:
  


Current Time: Thu Apr 25 11:28:10 GMT 2024

Powered by FUDForum. Page generated in 0.03538 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top