Jansson now builds on Windows

1,276 views
Skip to first unread message

Petri Lehtinen

unread,
Apr 29, 2012, 3:17:18 PM4/29/12
to jansso...@googlegroups.com
I finally got access to a Windows environment, and got Jansson to
build on MSVC++ Express 2010. I pushed the changes to the master
branch on GitHub, so if any Windows user is willing to test it, please
let me know of any issues.

The library can be compiled like this:

1. Create an empty DLL project

2. Rename src/jansson_config.h.win32 to src/jansson_config.h

3. Add all source files under src/ to the project

4. Use src/jansson.def as the linker definition file. This makes
correct symbols end up in the DLL.

And that should be it. It should compile on both C++ and C-only modes.

I'm happy that this long-standing issue has now been dealt with. I
hope this makes it finally possible to use Jansson also on Windows.

Petri

rogerz

unread,
Apr 29, 2012, 10:02:53 PM4/29/12
to jansso...@googlegroups.com
On Monday, April 30, 2012, Petri Lehtinen wrote:

The library can be compiled like this:
...

1. Create an empty DLL project
2. Rename src/jansson_config.h.win32 to src/jansson_config.h
3. Add all source files under src/ to the project
4. Use src/jansson.def as the linker definition file. This makes
  correct symbols end up in the DLL.

I wonder why you didn't put the VS project file into source control? Any concerns?
P.S. I thought jansson could be built with MinGW before.


--
 ,---.  Rogerz Zhang
( @ @ ) Human, not octopus
 ).-.(  Chase what you love. Let the rest go.
'/|||\` Code > Github | Note > Tumblr | Random > twitter 微博 | Share > Google+ 
  '|`   AsciiArt < Shimrod(hh)

Petri Lehtinen

unread,
Apr 30, 2012, 1:45:21 AM4/30/12
to jansso...@googlegroups.com
rogerz wrote:
> On Monday, April 30, 2012, Petri Lehtinen wrote:
>
>
> The library can be compiled like this:
> ...
> 1. Create an empty DLL project
> 2. Rename src/jansson_config.h.win32 to src/jansson_config.h
> 3. Add all source files under src/ to the project
> 4. Use src/jansson.def as the linker definition file. This makes
>   correct symbols end up in the DLL.
>
>
> I wonder why you didn't put the VS project file into source control? Any
> concerns?

Well, I've never used MSVC++ before, so I'm a bit confused about
projects and solutions, and I don't know which files define a project.
Furthermore, I don't know how to use a relative path to the .def file
(I only got it to work using a full path), and I'm not sure whether
the library should be compiled in C or C++ mode by default, or does it
matter.

But you're rigt, it would probably be the best to include the project
file(s) for the ease of use.

> P.S. I thought jansson could be built with MinGW before.

That's correct, but I felt that MSVC++ is so much more popular than
MinGW that this really wasn't enough for "true" Windows support.

Petri

rogerz

unread,
Apr 30, 2012, 10:30:46 AM4/30/12
to jansso...@googlegroups.com
On Mon, Apr 30, 2012 at 1:45 PM, Petri Lehtinen <pe...@digip.org> wrote:

rogerz wrote:
> I wonder why you didn't put the VS project file into source control? Any
> concerns?

Well, I've never used MSVC++ before, so I'm a bit confused about
projects and solutions, and I don't know which files define a project.
Furthermore, I don't know how to use a relative path to the .def file
(I only got it to work using a full path), and I'm not sure whether
the library should be compiled in C or C++ mode by default, or does it
matter.
 
Solution is just a collection of projects. You may include the test targets in addition to jansson library project. Something like one Makefile can hold multiple targets. See libyaml https://github.com/yaml/libyaml for example. 

But you're rigt, it would probably be the best to include the project
 
I've created one. Please see pull request. However, it is quite difficult to create all the test project so I finally gave up.
 
> P.S. I thought jansson could be built with MinGW before.

That's correct, but I felt that MSVC++ is so much more popular than
MinGW that this really wasn't enough for "true" Windows support.

Now it is broken on MinGW because _strtoi64() is MSVC only. I think MinGW is also popular for developers working under windows but like the unix way.

Petri Lehtinen

unread,
May 3, 2012, 2:33:29 PM5/3/12
to jansso...@googlegroups.com
rogerz wrote:
> I've created one. Please see pull request. However, it is quite difficult to
> create all the test project so I finally gave up.

Hi, and sorry for the late reply.

The changes you sent work wonderfully, thanks. I especially like how
you moved everything that is win32-specific under the win32 directory.

> Now it is broken on MinGW because _strtoi64() is MSVC only. I think MinGW is
> also popular for developers working under windows but like the unix way.

Ah, I didn't test MinGW. Thanks for fixing this, too.

Petri

Anushka Chandrababu

unread,
Feb 1, 2017, 12:12:24 AM2/1/17
to Jansson users
  Hi,

I tried to access Jansson from the github location at https://github.com/akheron/jansson.

But I couldnt find the src/jansson_config.h.win32 file that you were referring to. 

Can you please help.

Thank You
Anushka

Petri Lehtinen

unread,
Feb 2, 2017, 12:55:18 AM2/2/17
to jansso...@googlegroups.com
Anushka Chandrababu wrote:
>   Hi,
>
> I tried to access Jansson from the github location at https://github.com/
> akheron/jansson.
>
> But I couldnt find the src/jansson_config.h.win32 file that you were referring
> to. 
>
> Can you please help.

Hi.

Things have changed since that announcement 4 and a half years ago :)

See this link for up-to-date instructions for Windows:

http://jansson.readthedocs.io/en/2.9/gettingstarted.html#cmake-various-platforms-including-windows

Petri
signature.asc
Reply all
Reply to author
Forward
0 new messages