[REQ] a static library

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

[REQ] a static library

Postby Yustme » Fri Aug 15, 2008 5:37 pm

Hi,

I want to make an .exe file out of my demo without shipping all the lib's and dll's.

Is there a chance any of the developers can create a static library?

Thanks in advance!
Yustme
 
Posts: 37
Joined: Sat Dec 08, 2007 2:06 pm

Re: [REQ] a static library

Postby Julio Jerez » Fri Aug 15, 2008 5:51 pm

newton comes with static libraries. In fact only the windoes version of Netwon is distributed in dll from. all oteh platform are static libraries. in the SDK there are few folders,

    dll_vs9 is the dll form
    lib_vs9_md is the static multithraded dll. for applications that link system libraries dlls
    lib_vs9_mt is the static mutihreaded, for applications that do not use systems dlls, because they are all statically linked.
I suggest using lib_vs9_mt because the end user do not nee to use installers, since the application will ha ve every thing.
This one generates bigger exectables.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: [REQ] a static library

Postby Yustme » Fri Aug 15, 2008 6:17 pm

Hi Julio,

Probably a stupid question, but if i include the lib you suggest in my project directory, do i need the dll too?

Because if i run the demo, it asks for the dll too.

I am on windows vs2008.
Yustme
 
Posts: 37
Joined: Sat Dec 08, 2007 2:06 pm

Re: [REQ] a static library

Postby agi_shi » Fri Aug 15, 2008 6:24 pm

Yustme wrote:Hi Julio,

Probably a stupid question, but if i include the lib you suggest in my project directory, do i need the dll too?

Because if i run the demo, it asks for the dll too.

I am on windows vs2008.

You don't need the lib or the dll in your project directory if you link to the static lib, you only need to relink your project using it.
agi_shi
 
Posts: 263
Joined: Fri Aug 17, 2007 6:54 pm

Re: [REQ] a static library

Postby Julio Jerez » Fri Aug 15, 2008 6:36 pm

Yutsme if it ask for teh DLL it is because you are still linking to the dll.
you need to make sure this defined
#define _NEWTON_USE_LIB
is declared, in order to link to any of the static libraries.
also make sure the path to the correct library is right.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: [REQ] a static library

Postby Yustme » Fri Aug 15, 2008 7:21 pm

Hi guys,

I pasted the .lib file in my project dir and got it successfully compiled. But i get a runtime error when it tries to create a collision shape for an object.

I did not understood agi_shi with relinking to my project using it.

There isn't even a tutorial on how to link to a static lib on the net. This is crazy!
Yustme
 
Posts: 37
Joined: Sat Dec 08, 2007 2:06 pm

Re: [REQ] a static library

Postby Julio Jerez » Fri Aug 15, 2008 7:41 pm

you do not need to copy the library.
In visual studio open the link->additional library dependencies property and change the path to the ststic library is.
in the c/c++->Preprocessor definitions add the define _NEWTON_USE_LIB

and that shopuld be evreything you need to do.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: [REQ] a static library

Postby Yustme » Sat Aug 16, 2008 4:58 am

Hi Julio,

I did exactly what you told me, i still get the nullpointer exception when trying to create the body.

The collision variable is NULL.

I added in options of vs the lib file like this: Linker -> input -> Additional Dependencies -> D:\NewtonSDK_Beta_17\sdk\lib_vs9_mt\newton.lib . I tried both the MD and MT version.

And the preprocessor is added too. What might cause the null pointer exception?
Yustme
 
Posts: 37
Joined: Sat Dec 08, 2007 2:06 pm

Re: [REQ] a static library

Postby martinsm » Sat Aug 16, 2008 6:13 am

Why do you have collision variable NULL?
Body needs collision to create it. If you pass NULL as collision, you most probably will get NULL pointer exception.
martinsm
 
Posts: 86
Joined: Mon Dec 19, 2005 3:15 pm
Location: Latvia

Re: [REQ] a static library

Postby Yustme » Sat Aug 16, 2008 6:37 am

Hi,

Nevermind, something else was messing up.

martinsm:

Code: Select all
NewtonCollision *collision = NewtonCreateConvexHull(world, nVertices, vertices, sizeof(float) * 3, 0.01f, NULL);

// create the body
NewtonBody* body = NewtonCreateBody(world, collision); // collision = NULL at this point <----
Yustme
 
Posts: 37
Joined: Sat Dec 08, 2007 2:06 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 8 guests