Re: [Boost-users] Boost Regex in a DLL

Dear Sir, First of all, thank you for your reply. Your replies for my requests were very helpful.
You can use Boost.Regex in a dll by defining BOOST_REGEX_DYN_LINK when building your dll, but as long as the regex code is isolated to your dll and doesn't spill over into it's public interface then this shouldn't be necessary. Other than that it's hard to say what the issue might be without seeing your code.
As you said, the regex code is isolated in my dll and doesn't spill over into the public interface. Then the problem could be with my code below. Would you please inspect and correct me if I am wrong somewhere?
I read a phrase from a file and search for words preceded by "W=" and if the word is different from !NULL, sil, and SIL, I store them in a list called PhraseList for further processing.
boost::regex re("W=\\w+");
boost::regex sre("!NULL|sil|SIL");
string s, sbuf;
string::const_iterator begin, end;
size_t length;
sbuf = phrase;
begin = sbuf.begin();
end = sbuf.end();
boost::match_resultsstd::string::const_iteratormatches;
boost::match_flag_type flags = boost::match_default;
while(boost::regex_search(begin, end, matches, re, flags))
{
if(boost::regex_search(phrase, re))
{
s= matches.str();
length=matches.str().size();
string item =s.substr(2,length-1);
if(boost::regex_match(item,sre))
break;
else{
phraseList.addString (item.c_str());
break;
}//else
} //if
}//while
I have the following code which does the job without any problem at the expense of "not using boost".
I have a line read from a file:
// Parse the line
len=strlen(phrase);
//If the phrase is a content bearing term, put it into phrase list
while(i

Metasebia Moges wrote:
As you said, the regex code is isolated in my dll and doesn't spill over into the public interface. Then the problem could be with my code below. Would you please inspect and correct me if I am wrong somewhere?
I read a phrase from a file and search for words preceded by "W=" and if the word is different from !NULL, sil, and SIL, I store them in a list called PhraseList for further processing.
I don't see anything obvious, you will either need to do some debugging to find out where the code is stalling, or else let me have a self-contained test case: obviously I'd prefer it if you try and locate the issue yourself first :-) John.
participants (2)
-
John Maddock
-
Metasebia Moges