Article View: comp.soft-sys.matlab
Article #200Using g++ to link a Mex file
From: James Gallagher
Date: Wed, 26 Jan 2000 00:00
Date: Wed, 26 Jan 2000 00:00
37 lines
2214 bytes
2214 bytes
Hi, Has anyone had any success using g++ (or GNU ld) to link a mex file? System information: Sparc 5, Solaris 2.6, gcc/g++ 2.95.1 with matching stdc++ library, Matlab 5.3.0... . Here's why I'm asking: I'm working on a mex file written in C++. The mex file uses two C++ libraries, one that I've written and also the stdc++ library. I've built many programs using these, so I'm fairly confident they are OK. However, my mex file crashes whenever a global C++ object is used and the exception processing is screwed up - ecxceptions thrown from within try/catch blocks are not caught. I suspect that constructors for global objects, and other setup code, is not being run by the mex file. I think that if g++ (or GNU ld appropriately instructed) is used to do the link rather than the system's linker, this problem would go away. I searched the help desk on the web and found an item that described building mex files using g++, but that seemed targeted at g++ 2.7.x which is fairly different from 2.95.x. In addition, I noticed that the gxxopts.sh file it showed used the system linker to actually build the mex file. Any help would *really* be appreciated! Thanks, James -- __________________________________________________________________________ James Gallagher The Distributed Oceanographic Data System jgallagher@gso.uri.edu http://unidata.ucar.edu/packages/dods Voice: 541.757.7992 Fax: 541.758.3254
Technical Details
Message-ID:
<388F5477.8D772D0F@gso.uri.edu>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 106e3f,7fa54047993df05d,start X-Google-Attributes: gid106e3f,public X-Google-Thread: 10ba33,7fa54047993df05d,start X-Google-Attributes: gid10ba33,public From: James Gallagher <jgallagher@gso.uri.edu> Subject: Using g++ to link a Mex file Date: 2000/01/26 Message-ID: <388F5477.8D772D0F@gso.uri.edu> X-Deja-AN: 577986983 Content-Transfer-Encoding: 7bit X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Trace: news.uswest.net 948917369 209.181.56.161 (Wed, 26 Jan 2000 14:09:29 CST) Organization: The University of Rhode Island MIME-Version: 1.0 NNTP-Posting-Date: Wed, 26 Jan 2000 14:09:29 CST Newsgroups: comp.soft-sys.matlab,gnu.g++.help