[SOLVED] Multiple applications and one dll

Tsh't

13-06-2008 21:53:50

Hello.
I have an issue and don't know if it's my compilation option or whatever...
When I try to run two apps, let's say a server and a client, each with a NxOgre World, I end up in a crash.
Exception is thrown when I use NxOgre::World world = new World(), at this line. I couldn't catch the type of exception however as I'm less experienced in Code::Blocks than VC, and C::B won't let the program crash if I run the CDB (windows debugger).
I suppose it's be a windows one as it's caught with (...) and not with std::exception.

I use Bleeding rev. 20., PhysX 2.8.1 and VC9 compiler.

I compiled the dll with the multithreading option.
The only time I experienced such an issue was when I used a DLL with a static member initialized twice.
I only tried debug version for now.

So did someone successfully tried running two samples at a time on the same machine ?

Tx for any clue (right now I'm trying with static version and get rid of these link errors).

Tsh't

14-06-2008 00:09:50

No chance with static lib either, and it works perfectly with multiple PhysX 2.8.1 samples at a time :?

Tsh't

11-07-2008 22:38:35

I switched to VC (I was with Code::Blocks) then I could use the microsoft debugger... The trouble is with the files NxOgre.html and NxOgre.leak.html.
If I run two exe in the same dir at the same time, NxOgre tries to open two times the same file for writing, then it crash when it tries to use the mStream to write some debug.

I added an option to choose log name (log-name in parameters) and it works a way better.

I think it could be a good feature to the great NxOgre to be able to choose log name...

betajaen

11-07-2008 22:46:49

Interesting bug.

I have a "fix" that was requested in another post; to disable the log completely and let the user have their own. I don't know how I could work the filenames in to the PhysXParams though; it may have to be a "#define".

reptor

12-07-2008 00:07:15

Well I noticed this as well. I had an error in which my application's process didn't close properly and when I tried to "restart" it, I got some error which complained something about the log file. Because then there was two processes trying to write to the same log file.

By the way, you should not be writing a log file into the application directory. Everything that a program writes, should go to user's "Documents and Settings\username\My Documents\myprogramname" directory. Well not necessarily to "My Documents", but certainly to "Documents and Settings\username".

You see, the user of the application might very well not have write access to the application's installation directory. If you assume it has, then you should be spanked or something :) Think about "Program files" dir on Windows as an example and not running as an administrator user but as a user with restricted privileges as you should be doing normally... I have seen way too many programs which assume write access to "Program files" that it makes me almost mad :)

Tsh't

12-07-2008 01:17:51

Yes, I wanted to keep it only on debug mode, for me... I agree on the "Documents and settings", we often had similar issues at work, with the windows rights :/

Betajaen :
I thought about a #define... But I think now it is not an always working solution because it will always be the same file name for two differents apps...

I think you got your ideas to fix this, but for the information I did just pass string by the parameters string (eg : new World("log-name : NxOgreClient ...) so that you can specify different files... As with the ogre logger.

Other solution, to use your own logger, you might do something like :

void nxogre_callback(NxOgre::NxString to_log)
{
//your logger code to be consistent with the other libs
}

That is, registering a callback logger somewhere. It's for example used in ZoidCom.

betajaen

12-07-2008 09:13:08

It actually better for you to make your own log class. The NxOgre one like with nearly all of it's virtual classes is an example and shouldn't be used in serious applications.

http://www.ogre3d.org/phpBB2addons/view ... 4146#44146

Tsh't

12-07-2008 11:38:53

Thanks for the link ! It's perfect.