|
Do you mean returning a const reference to a string
works, while returning a non-const copy does not? If this is the only
workaround, I'm not sure it'd be practical to implement.
Returning a copy of a string from a DLL should be OK,
and in fact I've seen applications that do this built with VS7/8
(including OSG when built with those compilers). Apparently, this is just an
issue with the Cygwin compilers, but like I said in a previous post, I'll need
to create a small set of code to reproduce the problem.
-Paul
From:
[EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Alan
Harris Sent: Saturday, September 02, 2006 5:26 AM To: osg
users Subject: Re: [osg-users] Cygwin build questions: ESRIShape
plugin and Producer
I am a niaive and new user of STL so apologise if this is known by
all.
I had problems with a DLL I created returning std::string, and
found that they generally had to be passed as const to fix the problem. I have
found no specification anywhere that const strings have to be used - but I
have to admit it may simply be an error in my coding.
Digging into
MS's library the std:string has a small buffer (16 chars) and only when a
larger string was passed / used / read was there a problem due to the
allocation of new space. The result was a crash due to trying to delete a bad
memory ref.
Alan
Paul Martz wrote:
This seems to be a problem with passing copies of a std::string between
DLLs. getApplicationName() creates a std::string from argv[0] and returns a
copy on the stack; the crash occurs at that time.
I modified osgviewer to not use ArgumentParser at all, and instead to simply
call readNodeFile( std::string( "cow.osg" )). I get the same kind of crash,
and this time it occurs when the std::string constructor returns.
I wonder if it's something as simple as a missing compiler option that would
resolve this issue.
-Paul
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] On Behalf Of Mario Valle
Sent: Wednesday, August 30, 2006 10:10 AM
To: osg users
Subject: Re: [osg-users] Cygwin build questions: ESRIShape
plugin and Producer
Yes,
but seems a memory corruption because no useful backtrace can
be obtained.
Using osgviewer dies in the
arguments.getApplicationUsage()->setApplicationName(arguments.
getApplicationName());
line. Maybe is something related to having only Visual Studio
6 on this machine (I cannot upgrade till I'm sure another
application still compile and runs without problems).
Anyway, I was so frustrated that I give up.
Now I'm trying to find a machine on which I can install
Visual Studio Express. And so return under Ma'a Microsoft.
What's a pity.
Thanks for your sympathy!
mario
Paul Martz wrote:
Thanks for the thorough notes. I'll try to get some time to
continue
working on this, hopefully this week.
It'd be nice to get to the bottom of why the binaries don't
render for you.
Have you tried building debug and watching what happens under gdb?
-Paul
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] On Behalf Of Mario
Valle
Sent: Tuesday, August 29, 2006 8:59 PM
To: osg users
Subject: Re: [osg-users] Cygwin build questions: ESRIShape
plugin and
Producer
Paul Martz wrote:
I've used Cygwin in the past for a few projects, and am now
trying to
use it to build current OSG/OT/P CVS source.
OT and P build fine. When I go to build OSG, it fails to find the
Producer include files while building osgProducer. I found
that I have
to explicitly export PRODUCER_INC_DIR and
PRODUCER_LIB_DIR in order
for the OSG build to find the Producer header and include
files. Is
this to be expected? (The Producer 'make install' puts things in
/usr/local/Producer/include and
/usr/local/Producer/lib.)
Once that issue was resolved, core OSG and some of the
plugins built.
However, the build failed in the ESRIShape plugin, failing
to compile
ESRIShape.cpp at line 38 because ::read was not defined.
Any help would be appreciated.
-Paul
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
Here are some sparse notes on building OSG under Cygwin.
It builds,
but fail at runtime and I do not understand why. Also the
OT example
WorkCrew has problems at runtime.
For your question, see point 5.
Hope you have more luck than me with Cygwn build.
Ciao!
mario
1) install the following packages (the full installer ones) under
d:/gnuwin32
freetype 2.1.10
jpeg 6b-4
libpng 1.2.8
libungif 4.1.4
tiff 3.8.2-1
2) create the build file d:/buildosg.sh as below
export OSG_ROOT=/cygdrive/d/OSG_OP_OT-1.1.1-rc1
export BSD_ROOT=/cygdrive/d/gnuwin32
export OPENTHREADS_INC_DIR=$OSG_ROOT/OpenThreads/include
export OPENTHREADS_LIB_DIR=$OSG_ROOT/OpenThreads/lib/CYGWIN32
export PRODUCER_INC_DIR=$OSG_ROOT/Producer/include
export PRODUCER_LIB_DIR=$OSG_ROOT/Producer/lib/CYGWIN32
export COMPILE_EXAMPLES=yes
export COMPILE_INTROSPECTION=no
export FREETYPE_INCLUDE=$BSD_ROOT/freetype/include
export FREETYPE_LIB=$BSD_ROOT/freetype/lib
export PATH=${PATH}:$BSD_ROOT/freetype/bin
export JPEG_INCLUDE=-I$BSD_ROOT/jpeg/include
export JPEG_LIB="-L$BSD_ROOT/jpeg/lib -ljpeg"
export GIF_INCLUDE=-I$BSD_ROOT/libungif/include
export GIF_LIB=$BSD_ROOT/libungif/lib
export TIFF_INCLUDE=-I$BSD_ROOT/tiff/include
export TIFF_LIBS=$BSD_ROOT/tiff/lib
export PNG_INCLUDE=-I$BSD_ROOT/libpng/include
export PNG_LIB=$BSD_ROOT/libpng/lib
export OSG_INC_DIR=$OSG_ROOT/OpenSceneGraph/include
export OSG_LIB_DIR=$OSG_ROOT/OpenSceneGraph/lib/CYGWIN32
make $*
3) build OpenThreads
Seems you need to copy uname.exe from cygwin into this
directory
to have
$(OS) correctly initialized.
in pthreads_src/GNUMakefile
remove the unneeded line 31: LIBS += -lpthread
cd OpenThreads
make
4) build Producer
cd ../Producer
d:/buildosg.sh
5) Edited
$OSG_ROOT\OpenSceneGraph\src\osgPlugins\ESRIShape\ESRIShape.cpp
#if defined(_MSC_VER) || defined(__MINGW32__) || defined(WIN32)
#include <io.h>
extern "C" int read(int, void *, unsigned int); #endif
6) Under the installed freetype
edit bin/freetype-config
verify that line 12 read as the following (no D:/gnuwin32....
it confound dependency tracking)
prefix=/cygdrive/d/gnuwin32/freetype
around line 144 edit the line to read
libs="-L$libdir -lfreetype -lz -Wl,-s -liberty -lintl -liconv
-lwsock32 -lole32 -luuid -lmsvcp60 "
4) For the jpeg plugin
edit $OSG_ROOT\OpenSceneGraph\src\osgPlugins\jpeg\GNUMakefile
and change
JPEG_LIBS to JPEG_LIB
(the former for some reason is not overriden by the script
definition)
5) For the gif plugin
edit GNUmakefile
ifeq ($(OS),HP-UX)
INC += $(GIF_INCLUDE)
else
INC += $(GIF_INCLUDE)
LINKARGS += -L$(GIF_LIB)
endif
6) For the tiff plugin
edit GNUMakefile
ifeq ($(OS),HP-UX)
INC += $(TIFF_INCLUDE)
else
INC += $(TIFF_INCLUDE)
#LDFLAGS += -L$(TIFF_LIBS)
LINKARGS += -L$(TIFF_LIBS) $(JPEG_LIB)
endif
7) For the png plugin
edit GNUMakefile
ifneq ($(OS),HP-UX)
INC += $(PNG_INCLUDE)
LINKARGS += -L$(PNG_LIB)
else
INC += $(PNG_INCLUDE)
endif
8) build OpenSceneGraph
cd OpenSceneGraph
d:/buildosg.sh
I had some "modification time is in the future" warning, so I
repeated the build procedure twice
x) to build the Producer examples define two new variables
(OSG_INC_DIR and OSG_LIB_DIR) and modify the GNUMakefile for
Trackball
LIBS = \
-L$(OSG_LIB_DIR) -losgProducer -losgDB -losgGA -losgText
-losgUtil -losg \
-lProducer -lOpenThreads
INC += -I$(OSG_INC_DIR)
--
Ing. Mario Valle
Visualization Group |
http://www.cscs.ch/~mvalle
Swiss National Supercomputing Centre (CSCS) | Tel: +41
(91) 610.82.60
v. Cantonale Galleria 2, 6928 Manno, Switzerland | Fax: +41
(91) 610.82.82
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
--
Ing. Mario Valle
Visualization Group |
http://www.cscs.ch/~mvalle
Swiss National Supercomputing Centre (CSCS) | Tel: +41
(91) 610.82.60
v. Cantonale Galleria 2, 6928 Manno, Switzerland | Fax: +41
(91) 610.82.82 _______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
|