Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

How to compile CoDeSys SP with ANSI-C++ compiler

ljean
2006-06-05
2008-01-25
  • ljean - 2006-06-05

    I received Starter Pack and I am currently trying to compile CoDeSys SP with Code Warrior.

    I need to force C++ compilation because other parts of the code need it (OS stuff that I can't modify)

    Unfortunately CoDeSys SP doesn't compile due to illegal implicit conversion in the code.

    MyType* myvar = SysAllocDataMemory(sizeof(MyType));

    I think it is OK in ANSI-C but forbidden in ANSI-C++

    where I must have

    MyType myvar = (MyType) SysAllocDataMemory(sizeof(MyType));

    Is there any possibilty to solve it only by tuning my compiler? Any other idea?

     
  • ljean - 2006-06-06

    It seems OK to compile SP with CodeWarrior by putting it in a library. The application contains only RtsSys and RtsCst and a link to the lib.

    There are some conversion issues: unsigned char to char for example

     
  • bvanbata - 2006-10-17

    Can you describe in more detail what it is that you are compiling? Do you have an applicaiton that you are compiling with CodeWarrior and then calling this application using the 'external library' functionality of the CoDeSys programming system? What is your operating system? What is the overall setup of your appliacation?

    I have many questions because I am also trying to compile some of my own functions (using Microsoft Visual Studio) and then would like to invoke these functions from CoDeSys blocks. I have found the process to be very troublesome.

    You comments would be very much appreciated.

    -Brian

     
  • ljean - 2006-10-18

    I was trying to compile the CoDeSys SP Runtime Systems with CodeWarrior. My target is Coldfire processor and SMX.

    My problem was that my main project is in C++ and that CoDeSys SP is in C and there are some compilation issues. I succeed to fix by putting CoDeSys SP in a separate library compiled in C and linked with my main C++ project.

    I think your pb is very different. I made some external libraries in the past and it's true that there are some tricks and you have to modify the generated h files a little bit. What is your target?

     
  • bvanbata - 2006-10-18

    Yes, it seems our pbs are quite different. But now I am curious... you are compiling the CoDeSys SP RunTime systems? How is this possible? Is this source code something that you can purchase from 3S? If so, how $$? Do you know if it is also possible to modify directly the SP RTE / SP PLCWinNT applications directly from source code?

    My current goal is to simply allow communication between CoDeSys applications running on a PC (CoDeSys IDE, SP RTE, etc...) and a CAN communication board. The CAN card is from Softing, and is provided with complete DLL interface and also a sample VB application. It seems that it should not be too difficult to create some code to transfer data between a CoDeSys application running in the SP RTE on the PC and the Softing CAN card. I have had trouble compiling simple C code in Visual Studio, but even after it is ok, now I cannot figure out how to run a simple application on the PC that calls c functions from the external library I have created.

     
  • Anonymous - 2008-01-25

    Originally created by: plivelic@metaind.de

    Hi,

    perhaps I have a breakethrough idea. Try to link a DLL in "CoDeSys SP". Es is possible to write some function in C/C++ make a suitable DLL and call these from CoDeSys (althouhg there is some guideline to follow). Then you can call Softing-card functions directly from your C-functions.

    Is it helpfull to you ?

     

Log in to post a comment.