I'm trying to create simple DER decoder - console application that just outputs content of given data structure (encoded in DER format, like this one).
I have problems with running this example: A ''Rectangle'' Decoder .
I'm trying to compile it with MSVC and I have problems with #include <inttypes.h>
and #include <netinet/in.h>
. Also type ssize_t
is undefined.
Here's what I've done for now:
1. At Online ASN.1 Compiler I pasted this code into textfield:
RectangleModule1 DEFINITIONS ::=
BEGIN
Rectangle ::= SEQUENCE {
height INTEGER,
width INTEGER
}
END
2. I selected "Use native machine types" and "Generate PER support" options.
3. It "Compiled OK" so I downloaded that output .tgz
4. Created empty project int Visual Studio 2010, drag-n-dropped source files extracted from this .tgz
5. Set additional include directory to "skeletons" directory of ASN1C
6. Tried to build it.
What am I missing?
Any help would be appreciated
The problem is that code generated by ASN1C must be modified in order to compile it with MSVC and to use it in Windows environment.
#include <inttypes.h>
should be replaced with #define ssize_t SSIZE_T
#include <netinet/in.h>
should be replaced with #include <Winsock2.h>
inline
should be removed from static
functions defined in asn_internal.h
After that, everything works fine ;)