FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

link error missing

 
Post new topic   Reply to topic     Forum Index -> Poseidon
View previous topic :: View next topic  
Author Message
Shawn Liu



Joined: 09 Mar 2005
Posts: 104
Location: Shanghai, China

PostPosted: Mon Feb 13, 2006 8:50 am    Post subject: link error missing Reply with quote

Currently, Poseidon can't capture the link error.
When link error occurs, due to library missing or target file in use, the linker will complain and output some words like "can't find some symbol" or "create file error".
But Poseidon can't receive the output.

The implementation is in "executer.d". The main approach is to use a pipe to redirect the output of "Build.exe".
The code is at
http://trac.dsource.org/projects/poseidon/browser/trunk/current/poseidon/poseidon/model/executer.d?rev=103#L122

Can somebody give some advice?
Back to top
View user's profile Send private message
Kuan Hsu



Joined: 15 Apr 2006
Posts: 143
Location: Taiwan

PostPosted: Sat Apr 15, 2006 7:54 am    Post subject: Re: link error missing Reply with quote

Sorry my poor Engish! I want to write by Chinese, but......

In executer.d, I use ReadFile() windows API call instead of readLine():

Code:

// Shawn Liu's original code
//
File file = new File(hReadPipe, FileMode.In);
while(!file.eof()){

   s = file.readLine();
            
   if(s.length  == 0 )
           break;
   if(dgEcho && display){
      display.syncExec(new StringObj(s), dgEcho);
   }
}         
file.close();   


My fix( ugly code )
Code:

// Hsu fix version
//
ubyte[1024] sBuffer;
char[] s;
uint lngBytesRead;
int count;
   
while( ReadFile( hReadPipe, sBuffer.ptr, 1024, &lngBytesRead, null ) )
{
   s.length = 0;

   // Transform ubyte to char
   for( int j = 0; j < lngBytesRead; j ++ )
      s ~= cast(char) sBuffer[j];
            
   if( s.length == 0 )   break;
   if(dgEcho && display) display.syncExec(new StringObj(s), dgEcho);
}

CloseHandle( hReadPipe );



Then, the linker error message can be captured!!

Maybe the readline() can't get the right characters, in my code, if I don't transform ubyte[] to char[], or directly declare sBuffer to char[1024], the message can't be captured.

Poseidon is a very good IDE for D language, but I feel if we can build our project use dmd.exe instead of Build.exe officially is better! Very Happy

Anyway, Thank to Shawn and qbert!!! Laughing
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Poseidon All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group