i need to manage a COM printer port by Tomcat webserver. I tried a lot of java solutions, for example RxTx library but i had a lot of troubles: when i switch off the printer the jvm crashed!!
Now i would like to use an jvm external library linked by JNA, so i need a C or C++ library with raw methods to read and write to a COM port. This library should be compile under windows or linux. Can I find somethings already done? (I can not write programs in C or C++).
Thank you.
Use Boost Asio!
Its guaranteed to be fully portable. Its also very reliable. I've actually used it in my own application (SMS sender through gsm devices using AT commands).
Please also see: Access the serial port in a platform-independant way
Try another one library: http://code.google.com/p/qextserialport/
This project targeted for Qt users.
Supports Qt4 and Qt5 both!
In case you're looking for something lightweight with no additional dependencies, I'd like to plug my own library https://github.com/nullpunktTUD/SerialPort
It is fully cross-platform and supports enumeration.
Related
I want to implement an auto-update or update notification method for my open-source project. My searches often lead me to libcurl.
I search much about HTTP-libs - and many times I ended up with libcurl ... but can I use it for Linux and Windows together?
My wish is to include only header-files (same header for Linux & WIndows, if possible) and add only OS-spefic lib flags with cmake or visual-studio project files. That way, I can compile the same code on both platforms.
Is that possible in general with libcurl? If yes, how do I do that directly?
Yes you can.
An application can use libcurl on both Linux and Windows with the source code parts that do the HTTP transfers being identical. libcurl provides the same API and it works the same on a vast amount of different operating systems.
I am looking for a C/C++ based http/websocket library with SSL(HTTPS/wss) support on Windows CE/Mobile that uses Windows SChannel (rather than OpenSSL). I ported over the wslay library so that I could use it with libcurl. This is turning out to be difficult to integrate. Is anyone aware of a library that I can use on Windows CE/Mobile platforms that's not dependent on OpenSSL?
I found POCO but that seemed to have OpenSSL dependencies. So in turn ended up porting wslay to Windows CE and filled in the necessary callbacks with libcurl's curl_easy_send and curl_easy_receive functions for IO. Wslay doesn't have an implemented IO layer and gives the user the choice to use the appropriate IO library needed. Libcurl doss come with SChannel support that made things even more easier for using secure WebSocket over wslay.
idevs.h, netinet/in_systm.h, netinet/ip.h, netinet/tcp.h openssl/ssl.h sys/socket.h
These header files can work in Linux but in visual studio 2008 compile error says unable to open header file. These are socket program related headers. (I am unable to get any proper result from web search)
Problem:
Please let me know any dll I have include for these headers or any other equivalent headers are available ?
Thanks in advance.
In windows environment you need to include the windows specific headers like winsock.h and others (http://msdn.microsoft.com/en-us/library/windows/desktop/ms738545(v=vs.85).aspx). You need to switch between headers using the #ifdef statements when doing builds for different platforms.
Nobody ever promised that windows implementation of the sockets concept is 100% identical to the one of Unix. These implementations have a lot in common, but differences are also present.
Sockets are not part of the C++ standard and are implemented in different ways in Linux and Windows. That means, that the native socket libraries are different in both OSes, and Windows has other headers for its socket API than Linux. So you will not only have to include other headers but might also need to use other functions.
Depending on what you want to achieve, you might want to use a library that wraps the OS specific parts and provides a portable interface. There are several more or less portable networking libraries, one of the best known might be Boost.Asio
I require zlib library for the development of Windows Store app.
Has anyone converted Win32 zlib project to WinRT yet?
Can anyone please describe the steps to convert the existing win32 static lib project to winRT?
Visual C++ is already a supported language for WinRT development, if you wan't to use zlib, just compile it together with your solution. There is nothing that is preventing you from reusing standard ISO C and C++ libraries from within the WinRT, if you are using the C++ language, you might have to expose certain aspects of your library as WinRT Components but only if you need to interface with facilities like XAML or other WinRT languages but that should be a walk in the park. Not something which is tremendously difficult to do.
The whole point of supporting C++ in the WinRT is to allow an existing ecosystem of largely native applications to be ported to the Windows Store. zlib is not an exception. Non-standard ISO C and C++ such as sockets are not supported but there you have alternatives that you can plug-in to, just check that the library you're using has some kind of portability support.
WinRT is very limited with regards to C library functions which are present. What this means is that virtually all cross-platform C libraries are (AFAIK, I'm not a WinRT dev) unusable for that target.
For the case of zlib, there is an alternative: see this question
EDIT: to clarify what I'm saying above, I dug up a list of all CRT functions that are absent for WinRT, which you can find here. As long as zlib or any other C library does not depend on these function calls, you should be able to use the WinRT tools to build that C library. I even found a project file for zlib on winrt by the Ogre team here, not sure how useful it is to you.
You could take a look into this WinRT (Un)Zip component. Its used in production code already.
See the unit tests inside on how to use the component. It compiles on all WinRT architectures including ARM. It has no custom asm for ARM though.
I am looking to create a C++ library that can be used by both Linux and Windows clients. The OS specific functionality will be hooked up by the client by implementing the interfaces provided by the library.
Is this possible to achieve? Do I need to recompile the C++ project again in linux.
P.S: I am using CodeBlocks IDE
The short answer is no, you still need to compile your library for each targetted platform -- however, assuming your code is written such that it is cross-platform, you can set up your build to target both Windows and Linux environments with little fuss. I do this now using CMake to generate both Visual Studio projects for Windows environments and Makefiles for Linux environments.
I'm pretty confident that Linux will not accept a .dll :) And yes, you will need to recompile. Unless you run windows as a virtual machine under linux which sort of preempts the question.
It certainly cannot be the same binary file: shared objects ELF format on Linux, DLL "PE" format on Windows. And dynamic loading has different semantics on both systems. See Levine's linker and loader book for details.
You could, if done carefully, have the same source code giving the two different files (the DLL on Windows, the dynamic shared object on Linux).
But you probably would need some conditional compilation tricks like #ifdef WINDOWS etc...
You might use libraries providing you a common abstraction for such things. For instance, both GTK/Glib and Qt have some mechanism giving a common abstraction of dynamically linked (or dynamically loaded - ie dlopen-ed) libraries.
You probably want to read the Program Library Howto (at least for Linux).