how to import c code to TwinCAT - plc

I am quite new to TwinCAT 3.I am trying to import a C code from Dymola to TwinCAT 3.I have gone through BECKHOFF manual but it didn't help much.
It would be grateful,if you could help me.

Ok, i understand. Beckhoff place restrictions on both how the code is put together and how much of the language / frameworks you can use. You can't use third party dlls either (so the wrapper idea is out). You can import modules that have been put together in the TwinCAT way.
To start with, you will need to port your code into TwinCAT C++ directly, following the method of putting modules together, as per the instructions you followed. How much you'll actually need to change depends on the complexity of the c code, of course. A lot is syntactically identical. You can Google "compile c code for c++" for the main differences.
I'm no expert on the c++ bit of TC3, but this is my understanding. All the best with it!
LazzMaTazz

Related

Structure of lisp projects

When I use Eclipse or Visual Studio or Xcode, structure of the project gets created automatically and one can get started immediately.
Now I am trying to create a project on Allegro CL express edition and if I collect all lisp files and run it, it shows package errors which I believe is because of files not getting executed in a specific order as packages must be created in some file that must be executed first.
I am not able to understand how to approach this problem. There is no or little information on creating large projects in lisp and how to incrementally deal with its size and complexity.
I want to port Maxima onto Allegro CL. Can I get some help here and also if one can explain this break up of code in multiple files and packages and basically how to load the whole system.
I know basics of lisp but I don't understand lisp project's structure.
Good news: Maxima already has an Allegro port. You should be able to build it using ./configure --with-acl then type make. I haven't used this recently, but I would expect this to work.
If you want to know more about how stuff is loaded, look at src/maxima.system. It's a bit archaic because it is written for defsystem, which has now been replaced pretty much everywhere else by asdf.
Well, Maxima can be compiled via defsystem or asdf by several Lisps, including Allegro. See INSTALL.lisp for details.
The only limitation that I know of is that the Allegro Express version cannot compile the SLATEC-derived code (the functions translated from Fortran are too big or something like that). So you will have to comment out the SLATEC stuff in maxima.system or maxima.asd.

What is a good resource/method for me to learn making Qt GUIs for Perl?

I am decent with Perl, and I've chosen to start learning making GUI interfaces for my Perl programs. That said, I've found it hard to learning how to make a GUI with Qt. I have the bindings from http://code.google.com/p/perlqt4 which seem to be the most recent, but as to how to use them I'm still a bit stumped. All the books and tutorials on the net that I can find are either geared towards using Qt with C++ or with Python.
I'm an absolute Qt beginner and would like to learn how to use it with Perl, but unfortunately the net seems scarce on material for me to use. I can make a GUI design with QtDesigner but don't know how I can fit the code that it generates together with Perl. I can copy the examples from http://code.google.com/p/perlqt4/source/browse/qtgui/examples/tutorial , but those are simple programs withe no accompanying documentation that would allow me to know what is going on or why the code was written that way.
I don't know how Qt or the bindings work but I'd like to learn. Everything that I can find is either obsolete or written for bindings for other languages which I don't understand. I was hoping that some people who've already done this would give me some solid advice or point to some good resources so that I could start learning.
If making a GUI is what you want to do, please consider CitrusPerl that builds on top of wxPerl which is nothing more than a wrapper around wxWidgets. It also makes it very easy to create installers or packagers with the use of Cava Deployment Tools.
TIMTOWTDI
After struggling a further day with the stuff qt4 + perl ..it works in that (stackexchange) way. I use a standard debian wheezy distribution with the packages libqtcore4-perl and libqtgui4-qt etc. Sources from Chris Burel can be found under CPAN or GIT. Regards

Why is everything that concerns CvSeq in OpenCV is such a mess?

So, I have a project at my job using OpenCV (and it's actually the first project I'm doing with OpenCV) and I have to use stuff like CvSeq to use the SURF algorithm. Since I started to put that in my code, it's a total mess. Apparently, it compiles, but, at least Eclipse, is considering that there's a bunch of errors. All the definitions are messed up.
So, is the problem with Eclipse, or is it that the new header files of OpenCV are just that bad, at least for that part.
I would highly recommend you use the new C++ interface of OpenCV. It will allow you to use vector<KeyPoint> objects, which is far easier to use than CvSeq as I'm sure you've seen. The C++ interface also has far more features than the old C interface.
Here is a good OpenCV sample doing descriptor matching.
Hope that is helpful.

C++ static library to be used in XCode

This is probably not a simple question so I am not looking for a definite answer but just some pointers to get me in the right direction.
I have absolutely no experience with C/C++ but have good knowledge of Objective-C. I also don't know much about different compilers and architectures so please be nice if I am talking stupid :)
I have some MatLab code that needs to be ported to Objective-C to run on an iPhone application. My first tentative path to get this done would be to check if MatLab can export the code as a static C/C++ library that I can call from within my Objective-C code.
This seems to be the case but I am not entirely sure what to do next, and what things I need to keep in mind when compiling the library on the MatLab side (i.e. architecture, compatibility, PC vs Mac, etc).
I have been provided with a .DLL and .LIB files which I believe are Windows compiled so they will not be useful for me, is this correct? From working with previous static libraries I can see they all have a .a extension - what do I need to do to get one that is compatible with the iPhone architecture?
And once I get the library compiled, how to I import and use it within my project? Will I just be able to call the public methods directly from within my code?
What else do I need to know or be aware of?
Any help is very much appreciated!
Thanks,
Rog
Static libraries contain binary code tailored for some specific operating system and platform. That means that it will use the OS to internally acquire memory (if it uses dynamic memory) or to perform any other OS specific operation (logging, output).
Even if the generated code was completely OS-agnostic (basic math could be implemented without OS support), the platform is completely different, matlab will generate code for an intel platform and the iPhone runs in an ARM architecture, with a different instruction set calling conventions...
Unless matlab is able to generate static libraries for the iPhone or at the very least for an ARM platform and make it OS-agnostic, you are out of luck.

How do I use a 3rd party C library in Xcode for my iphone project?

love this site and all helpful people! I'm newbie to Xcode and iPhone programming but I've pretty much got the hang of using the SDK to make programs in Obj-C (simple programs right now but make me happy). My experience is web programming (such as PHP and Perl) and I'm not really used to a lot of the new Xcode/desktopy-app stuff like static libraries and linking and such. I be honest, I am not total awesome programmer yet!
I have a problem right now, my (card game) program I am writing needs to use this C library. I don't really understand how I get the proper C files and integrate them into my project so I can start using the commands in that tutorial to evaluate hand values.
I hope I have been clear, please let me know if there is anything I am leaving out. Unfortunately, my newbieness may prevent from me making everything so clear and sometimes I can't english perfectly what I am thinking!
Happy thanks in advance, looking forward to any help!
Couple things:
The library you linked to is quite large. Pokersource appears to be a large C project containing all sorts of things like language bindings and some GUI tools as well. A project that large certainly has an IRC channel. I would recommend going there.
The library you linked to appears to be (I may be wrong about this), licensed under the GPLv3. This means that any program that you distribute to others that uses a GPLv3 library or piece of code must also be licensed under the GPLv3. The upshot is that if you use that library, you'll have to release the source for your game.
The site you linked to does seem to have a long list of other poker hand evaluators, so its possible one of them is suitable for your needs.
Good luck!
it's totally possible to use third party static libraries with your iPhone and using Xcode. This webpage illustrates the process of doing it.