From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24412 invoked by alias); 27 Mar 2007 17:39:59 -0000 Received: (qmail 24368 invoked by uid 48); 27 Mar 2007 17:39:41 -0000 Date: Tue, 27 Mar 2007 17:39:00 -0000 Message-ID: <20070327173941.24367.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug libstdc++/31368] basic_string and unsigned short leads to memory fault In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "gregoryk at edifecs dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-03/txt/msg02593.txt.bz2 ------- Comment #10 from gregoryk at edifecs dot com 2007-03-27 18:39 ------- Got it, thanks. In may original test I was relaying on LD_LIBRARY_PATH to have current folder in the values. And there was no checking of dlopen result for simplicity. Here is updated code. It will search for libloader.so in current folder. #include #include #include "loader.h" typedef void *pfLoader(std::ustring&); int main(int argc, char* argv[]) { void * libHandle = dlopen("./libloader.so", RTLD_NOW|RTLD_GLOBAL); if (0 == libHandle) { printf("Can not load \"./libloader.so\".\n"); return 1; } pfLoader* pF = (pfLoader*)dlsym(libHandle, "read_string"); if (0 == pF) { printf("Can not find function \"read_string\" in libloader.so\n"); return 2; } std::ustring s; // s.reserve(1); // uncomment this line to prevent abort pF(s); return 0; } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31368