'Information/Programming'에 해당되는 글 32건

  1. 2009.09.17 심심해서 테트리스를 짜보다... 13 by Dansoonie
  2. 2009.09.10 The Mythical Man-Month Chapter 1 2 by Dansoonie
  3. 2009.09.09 Something worth knowing about HttpEndRequest by Dansoonie
  4. 2009.06.27 Using HttpSendRequestEx for large POST requests 3 by Dansoonie
  5. 2009.06.12 WinINet Error Message ERROR_INTERNET_SECURITY_CHANNEL_ERROR 2 by Dansoonie
  6. 2009.02.12 Basics of Compilers... 5 by Dansoonie
  7. 2009.02.03 Building curl 17.19.3 with OpenSSL and zlib on MSVC 2 by Dansoonie
  8. 2009.02.02 Building openSSL 0.9.8j on Windows 2 by Dansoonie
  9. 2009.01.13 Working with WebCore in Webkit... 4 by Dansoonie
  10. 2008.11.23 Making your code more portable by avoiding inlining??? 6 by Dansoonie

요새 심란한 일이 많이 있어서, 마음을 가다듬고 무엇인가에 집중해야겠다는 생각이 들어서 테트리스를 만들어봤다. 자바스크립트와 CSS만 사용해서 짰음...

자바스크립트 처음으로 제대로 써본 것인데, 만족할만한 결과다...
CSS는 몰라서 대충 조잡하게 사용했다...
소스는 여기에...

소스틑 GitHub에 올려놨습니다. (https://github.com/dansoonie/TetrisInJavascript)


 ※ 원래는 여기서 바로 게임을 할 수 있도록 해놨는데, 최근에 이 글을 다시 보다가 다시 편집하려다가보니 티스토리 글 저장 방식이 바뀌어 옛날처럼 자바스크립트가 본문에 그대로 저장이 되지 않아(자기 마음대로 <br/> 넣고 나름대로 태그들 억지로 해석해서 재배열하고) 이제는 블로그에서 직접 테트리스를 못하게 되었네요... 아쉽네요... 스크린샷만 올립니다...  소스다운받아서 브라우져에서 열면 됩니다.

 


Posted by Dansoonie
요즘에 The Mythical Man-Month라는 소프트웨어 프로젝트 관리에 대한 문제를 소프트웨어 공학적인 측면에서 접근하여 에세이 식으로 쓰여진 책을 읽고 있다. 좀 오래전에 쓰여진 책이라 그런지 아니면 기술 문서가 아닌 에세이 형식으로 쓰여져서 그런지 몰라도 저자의 영어 문장 구사에 상당한 기교가 들어가 있는듯 하여 좀 이해하는데 어려움이 있어서 스스로 내용도 정리하고, 책을 읽기 싫어하는 많은 사람들을 위해 블로그에 그 내용을 간단히 정리하여 연재 하기로 했다. 이 책을 읽어보신 분께서는 해석이 잘못되었다고 생각하시는 것은 지적은 환영합니다~



Chapter 1 The tar pit
선사시대의 한 장면을 떠오르면 아마도, 타르구덩이에 빠져서 헤어나오지 못하는 짐승을 떠오르는 것 처럼 생생 장면은 없을 것이다. 그 짐승이 얼마나 힘이 세든지 타르 구덩이에서 헤어나오려고 하면 할 수록 타르 구덩이에 깊숙이 빠져들게 된다. 소프트웨어 개발 프로젝트도 이와 같다. 프로젝트 진행에 문제가 생겨 해결하려고 발버둥치면 칠수록 더욱 엉망이 되어 결국 실패하게 된다. 왜그럴까? 우리의 이런 문제를 해결하기 위해서는 먼저 소프트웨어 개발이 무엇인지 살펴보고 그 내면의 특성을 잘 이해해야 한다.

누구든지 한번쯤 차고 안에서 훌륭한 소프트웨어를 개발한 듀오들에 대한 이야기를 들어봤을 것이다. 하지만 이렇게 훌륭한 프로그래밍 듀오들이 존재함에도 불구하고, 현실에서는 그런 인력들로 소프트웨어 개발 인력이 대체되지 않는 이유는 무엇일까?

차고 출신의 프로그래밍 듀오가 개발한 소프트웨어는 그저 프로그램에 지나지 않는다. 프로그램이 더 많은 수익을 창출 두가지 방법으로 가능한데, 첫번째 방법은 프로그램을 어떤 플랫폼에서든지 돌아갈 수 있는 범용성을 갖게 만드는 것이다. 그리고, 언제든지 프로그램을 수정하거나 개선할 수 있도록 문서화가 잘 되어 있어야 한다. 이런 프로그램은 우리는 프로그램 패키지라고 한다. 두번째 방법은 input과 output에 대한 인터페이를 잘 정의 한 후에 컴포넌트화 시켜서 그 재활용성을 증대하는 방법이다. 각 방법은 프로그램의 가치를 3배까지 증대 시킬 수 있다고 보는데, 이 두가지 방법을 모두 적용하면 그 가치를 9배로 증가시킬 수 있다. 그렇다면 이런 소프트웨어 개발이이란 도대체 어떤것인가?

  1. 소프트웨어 개발은 인간의 창작욕구를 충족시켜준다.
  2. 사람들에게 유용한 소프트웨어를 만드는 것은 우리에게 뿌듯함을 준다.
  3. 소프트웨어 개발은 문제풀이와 비슷해 문제를 해결하면 큰 성취감을 준다.
  4. 소프트웨어를 개발하면 늘 새로운 것을 배울 수 있게 된다.
  5. 소프트웨어 개발은 매우 손쉽게 할 수 있다.

우리에게 이렇게 즐거움을 선사하는 소프트웨어 개발이 왜 그렇게 어려운가?

  1. 소프트웨어는 완벽해야 하지만 우리는 완벽하지 않다.
  2. 우리는 어떤 소프트웨어를 개발해야 하는지 잘 이해하지 못한다.
  3. 다른 사람이 개발한 소프트웨어에 의존하기도 한다.
  4. 창작은 힘들지만, 그것을 현실화 하는것은 많은 인내가 필요로 한다.
  5. 디버깅 작업은 버그가 줄어들 수록 시간이 더 오래걸린다.
  6. 참신했던 아이디어도 개발을 완료하면 이미 진부한 것이 되기도 한다.


이렇게 소프트웨어 개발은 우리에게 즐거움도 주지만 어려움도 준다.

Posted by Dansoonie
It's not something MAJORLY important, but I thought it is worth knowing it.

I just found out that by the time when HttpEndRequest completes, the header of the response is already available. Which means, you are able to call HttpQueryInfo on the resource handle(handle obtained from HttpOpenRequest()) for further actions.

Was this something obvious?
Because, the MSDN description of HttpEndRequest is nothing more than this
Ends an HTTP request that was initiated by HttpSendRequestEx.

I didn't know this until now. I came to learn about this fact by reading and article on how to "How to use HttpSendRequestEx with password-protected URLs." The following is an excerpt from the article where I have been able to realize the fact.
Unlike HttpSendRequest, HttpSendRequestEx will not resubmit a request on its own after receiving the "401 Access Denied" status code from the server. Therefore, HttpEndRequest will fail with an ERROR_INTERNET_FORCE_RETRY error.

Great !!! I have learned something. However, I don't think that HttpEndRequest fails with ERROR_INTERNET_FORCE_RETRY error upon receiving "401 Access Denied" status code when network is supposed to behave asynchronously.

Ah... the frustration...
Microsoft should put more effort in making their document more complete if their API's lack consistency. Right??? I'm I missing something???
Posted by Dansoonie
Such a pain to use WinINet in Asynchronous mode, isn't it?

The WinINet section in MSDN documentation seems incomplete once you start to look for things you want to know about. The sample codes provided in MSDN documents and Technical Support pages are too simple to know the exact behavior of WinINet. However, by trial and error, I have learned a big deal about WinINet. As I am still in the process of learning how WinINet works and how I'm supposed to use it, I would like to share something about WinINet that could be really tricky.

As I am writing this post I will assume that  whoever is reading this already knows how to use the WinINet Windows API in some sort of way. All the details that I consider irrelevant to the following topic will not be explained here.

So the thing that I am going to talk about is...
Making a POST request with large data

More specifically, if you are stuck in a problem where you do a post operation typically with a sufficiently large sized file and you never get a response back see if this is your problem.

Check what your code's behavior is when InternetWriteFile() returns false, and GetLastError returns ERROR_IO_PENDING. An experienced programmer might be able to get things right, but without much knowledge about asynchronous IO the above situation was very confusing.

What happens when InternetWriteFile() return false, and the reason was because IO operation was already pending? What is your guess??? The problem that I had resulted from not knowing the exact behavior for such situation.

Here is what I thought would happen.
Since InternetWriteFile returned false, the operation failed... nothing is going to be written. Besides the last paramter for InternetWriteFile, which is an out parameter that indicates the number of bytes written to the file when the function returns results in the value 0 when the InternetWriteFile returns... Therefore, nothing happened, and nothing is going to happen until the pending IO operation completes and INTERNET_STATUS changes to INTERNET_STATUS_REQUEST_COMPLETE and InternetWriteFile() is called again.

From what I have learned yesterday, here is what really happens. However, this is not a confirmed fact, but my own understanding of the behavior.
When InternetWriteFile() returns false due to ERROR_IO_PENDING, the write operation takes place after the current pending operation(maybe it's the read operation on the buffer for the actual writing operation on the network that is pending) is finished. When that write operation is finished after the pending operation is finished, the out parameter which indicates the written number of bytes is updated.

For this reason, this is why all the WinINet examples on MSDN and tech support pages are written in the following manner. During the initialization, or the setup phase of WinINet, an event handle is created. When InternetWriteFile() returns false for a pending IO request, then it waits for the event handle to be signaled, using WaitForSingleObject(). Then the pending IO operation would eventual finish and the write operation will take place. After the write operation is finished, the INTERNET_STATUS will change to INTERNET_STATUS_REQUEST_COMPLETE and the Internet Status Callback Function will be called. SetEvent() is called on the event handle in the callback function, and the blocked thread will be able to resume. Since the requested write operation completed, the out parameter which in indicates the number of bytes written of InternetWriteFile() us updated properly, and everything is good !!!

When posting large data, InternetWriteFile() must be called several times in order to send data in portions. If you want to get things done right, the calculation of how much data has been sent so far must be accurate. And the calculation cannot be accurate if the information of number of bytes written resulting from InternetWriteFile() is inaccurate. And since the information is not updated accurately until the operation has finished, it has to wait.

How lame... you have to block your thread to get things right. So, I came up with an alternative solution. Make a flag which will be set when an ERROR_IO_PENDING occurs. Make a global(not literally, just has to be visible from the appropriate scope) variable, lets say something like dwBytesWritten, which will be used to get the bytes written information. Pass &dwBytesWritten as the last parameter to InternetWriteFile()  in order to retrieve the number of bytes that has been written. On INTERNET_STATUS_REQUEST_COMPLETE, check the flag. If the flag is set, then it means that the write request which was blocked previously because of another IO operation has finished, and the number of bytes written is updated on the vairable dwBytesWritten. So, you can now update the writing progress of data being posted.

Do you get it? It's really hard to put it into words...

Reference - http://support.microsoft.com/kb/177188/en-us

Posted by Dansoonie
Error messages in computer(or software) are important because they provide information about what is being done incorrectly. Think about the error messages you get in Microsoft Windows. Almost all the time, you have no idea what it means. In worse cases you only get the error code(simply a hex number). Such error messages fail to deliver adequate information to us for correcting our incorrect usage of the computer(or software). Sometimes, it's not even a bit better than having a error message at all. You're unable to interact with the computer... It's just like talking to a robot that says the same thing over and over.

If error messages fail to provide proper information to us for fixing a problem, how are we supposed to fix the problem??? We have to find the problem for ourselves in a Brute Force(sometimes worse and sometimes slightly better - because we may get clues from other problems) manner. This is a very time consuming and unpleasant task. In Korea we use the term "sap-jill" which literally means digging the ground(inefficient and maybe meaningless job) for such tasks. Anyway, thanks to the Internet and Google(and all the other search engines). If you are really lucky, somebody might have encountered your problem before you and might have posted a solution to your unknown problem.


Now to the main subject...
I was working with WinINet at work. And I was caught up in a problem where I get a ERROR_INTERNET_SECURITY_CHANNEL_ERROR whenever I make a request over SSL(which is now TLS). The explanation of the error in MSDN is as follows...

The application experienced an internal error loading the SSL libraries.

So??? I looked for solutions related to the error. Not much help. Most of the information related to that error message had something to do with SSL certificates. Therefore, I also thought that was my problem. After several days of "sap-jill", I had a weird feeling that I was looking at the wrong thing... But, still I had no clue what else to look about. And then... yesterday, I finally found a post suggesting that I use a program called fiddler2. It's a proxy that sits between your http(s) client and the http servers that logs every request and response. I used that to find out what my http client's problem was. As soon as I ran my program with fiddler2 running, fiddler2 gave me an error message that finally gave me an idea what my problem was. I don't exactly remember what the message was, but it had something to do with the host name. Some more observations led me to a conclusion that there was a problem in establishing a connection to the server. More specifically, using the wrong port number. As I was debugging my code, I found out that in the line where I call the WinINet function InternetConnect(), I pass a zero(0) as a parameter that indicates the port number I am using. Of course the zero was not hard coded, and it was retreiving the value from another object which abstracts the information of the URL. The funny thing is that if the port number is not specified in the URL explicitly, the method used to retreived the port number for the URL returns zero. While it is well known that certain protocols use predefined port numbers, I think this is a bad implementation. But, I discussed it with my boss, and he said that its behavior should kept the way it is now because it might cause other problems if we fix it(corporate secret--just being careful). Anyway, I had to make a conditional statement to check what kind of protocol it's using and pass the appropriate port number.

How was I supposed to know that from getting...
System Error 12157(0x2F7D): ERROR_INTERNET_SECURITY_CHANNEL_ERROR
with the description
"application experienced an internal error loading the SSL libraries."
Orz <- Do you see my frustration?


So, to my conclusion... This is what I have been trying to tell all the people who run into the error message ERROR_INTERNET_SECURITY_CHANNEL_ERROR and nothing makes sense. You might want to check if the port number is correctly passed into the InternetConnect() function. Actually, I found nothing about SSL libraries related to this error.

How ABSURD !!!


Posted by Dansoonie
내가 아버지께 내가 전산을 전공하면서 저지른 가장 큰 실수가 무엇이라고 생각하시는지 여쭤본다면... 아버지께서는 주저하지 않고, Compiler Design and Implementation이랑 Formal Lanugages 수업을 듣지 않은 것이라고 하실 것이다...

그동안 그 말을 무시했었는데, 나의 관심사가 그쪽으로 흘러가면서 좀 후회스럽다... 그래서 어제부터 아버지 책꽂이에서 쌥쳐온 Compiler 책을 무작정 보기 시작했다 !!! 독학으로 Compiler를 공부하리라 마음먹고 말이다...
바로 이 책인데... Compiler 관련 책으로는 아주 고전(참고로 나는 이책을 4살때 쯤부터 본것 같다... 다시한번 말하지만 읽지는 않고 보기만 했다... 아버지께서는 저 책 표지를 보여주시면서 컴퓨터는 이 그림처럼 재미있는것이라고 설명해 주셨었다 ㅡ.ㅡ;)으로 잘 알려져 있을것이다. 아마 이 사진을 보고 치를 떠시는 분도 있을지도 모르겠다... 어쨌든, 지금은 몇번째 에디션까지 나와있는지 모르겠지만, 저 에디션은 1988년에 수정되어서 재출간된 에디션인것 같다...

어쨌든... 어제 열공한 내용을 살짝 정리를 해보고자 한다... Just to show off what I have learned...
참 유치하다...      ^^;

Division between lexical and syntactic analysis is somewhat arbitrary, but...
  • Lexical constructs do not require recursion
  • Syntactic constructs often require recursion


Context-Free Grammars are formalization of recursive rules that can be used to guide syntactic analysis.

Analysis of the source program
  • Lexical Analysis: Detect errors where the characters remaining in the input do not form any token of the language
  • Syntax Analysis: Detects whether the token stream violates the syntax of the language
  • Semantic Analysis: Detect constructs that have the right syntactic structure but no meaning to the operation involved


Compiler Operation Phases
  1. Lexical Analysis
  2. Syntax Analysis
  3. Semantic Analysis
  4. Generate Intermediate Code
  5. Optimization
  6. Code Generation

(Symbolic-Table Manager and the Error Handler are involved in all phases)



Lexeme is a character sequence forming a token


Preprocessors produce input to compilers


Use of Preprocessors
  • Macro processing
  • File inclusion
  • Rational Preprocessing
  • language extension


Grouping Compilation Phases
  • Front-End: Phases that depend primarily on the source language and independent of the target machine. i.e. Lexical, Syntax analysis, creation of symbolic table, semantic analysis, and generation of intermediate code, (certain amount of optimization)
  • Back-End: Phases that do not depend on the source language, but just the intermediate language
Posted by Dansoonie
I needed the ssl features in the curl library. The latest version of curl package with ssl for windows being distributed is 7.15.0. I could have used that version, but my coworkers and I insisted on using the most recent version. So, I had to build curl for myself. Here is how I did it.

How I Built Curl 17.19.3 with OpenSSL and zlib
on Visual C++ 2005 Express
* Download the Compressed Project file to skip everything and simply extract and build.

* For building zlib on Windows with MSVC is straightforward download zlib source from http://www.zlib.net/. Extract files to a certain folder. Open (zlib source folder)\projects\visualc6\zlib.dsw and build.
* For building OpenSSL on Windows with MSVC, refer to previous post.


1. Download and Extraction
Download the curl source files from http://curl.haxx.se/download.html.
Extract the files to a certain folder. I used D:\work\curl-7.19.3


2. Add libraries
Create the following folders in the curl folder
libraries\include\zlib
libraries\include\openssl
Copy zlib.h and zconf.h to (curl source folder)\libraries\include\zlib
Copy (openssl source folder)\include\openssl\*.h to (curl source folder)\libraries\include\zlib

Create the following folders in the curl folder
libraries\lib
Copy libeay32.lib, ssleay32.lib from the OpenSSL build result, and zlib1.lib from the zlib build result to (curl source folder)\libraries\lib


3. Open solution
Among the extracted files, there should be vc6curl.dsw. Visual C++ 2005 Express will complain that the file is no longer supported. Let it update the file to the solution file with the sln file extension and stuff...


4. Change Project Settings
Right click on curllib project and select properties to change curllib's project settings.
Select the appropriate Project Configuration that you are willing to make changes to.
(Probably you would like to change both DLL-Debug and DLL-Release)

Add the following to Configuration Properties -> C/C++ -> General -> Additional Include Directories:
..\libraries\include
..\libraries\include\zlib

Add the following to Configuration Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions:
USE_OPENSSL
USE_SSLEAY
HAVE_ZLIB_H

Add the following to Configuration Properties -> Linker -> General -> Additional Library Directories:
..\libraries\lib

Add the following to Configuration Properties -> Linker -> Input -> Additional Dependencies:
zlib1.lib
libeay32.lib
ssleay32.lib


5. Build Solution
Try Ctrl + Alt + F7 and see what happens.





Posted by Dansoonie
** This post is based on http://crowback.tistory.com/entry/openssl-098i-버전-윈도우-환경하에서-컴파일하기 and INSTALL.W32 (plain text file that comes with the openSSL source)

I had to build openSSL on Windows platform at work. Since it's not something that will work simply as opening a solution file on visual studio and building it, I'm keeping a record on how I did it. Not that this is something really difficult, I hope this information can become handy for the ones who really need it.

The requirements...
- cl (Microsoft c/c++ compiler)
- ml (MASM - Microsoft macro assember)
- perl

My build evironment...
- cl: Visual C++ 2005 express (can download here)
- ml: Microsoft macro assember 8 (can download MASM here)
- perl: v5.10.0 built for cygwin-thread-multi-64int (can download cygwin here)
* Prior to building openSSL, check if cl and ml can be executed from command prompt by simply typing 'cl' and 'ml'. If cl and ml is properly executed, you can see the version and usage of cl or ml you are executing. If it seems like cl and ml is not being executed properly, refer to the following by extending "더보기".

1. Downloading Source Files and Extracting it
Download  Openssl-0.9.8j.tar.gz from http://www.openssl.org/source/ and extract it to a dedicated folder. In my case D:\Work\openssl-0.9.8j.
(tar.gz files open beautifully with 7-zip, which is a freeware that supports unpacking almost every compression format widely used these days)


2. Configure
Execute "Configure" perl script by typing the following in the command prompt, where the prefix argument specifies where openSSL will be installed. In my case c:\openssl.
> perl Configure VC-WIN32 --prefix=c:\openssl


3. Add Assembly Functions
Add assembly functions (really don't know what it means at the moment) by typing the following from the command prompt.
> ms\do_masm


4. Make the following modifications to files
4-1. in crypto\cversion.c line 105
return "OPENSSLDIR: \"" OPENSSLDIR "\"";

return "OPENSSLDIR: \" OPENSSLDIR \"";

4-2. in crypto\cryptlib.c line 84~86
#define X509_CERT_DIR  OPENSSLDIR "/certs"
#define X509_CERT_FILE  OPENSSLDIR "/cert.pem"
#define X509_PRIVATE_DIR OPENSSLDIR "/private"

#define X509_CERT_DIR  OPENSSLDIR "\\certs"
#define X509_CERT_FILE  OPENSSLDIR "\\cert.pem"
#define X509_PRIVATE_DIR OPENSSLDIR "\\private"

4-3. in crypto\opensslconf.h line 107~108
(the dir path may differ depending on the argument used for prefix when configuring)
#define ENGINESDIR "c:\openssl/lib/engines"
#define OPENSSLDIR "c:\openssl/ssl"

#define ENGINESDIR "c:\\openssl\\lib\\engines"
#define OPENSSLDIR "c:\\openssl\\ssl"


5. Build, Test, Install
> nmake -f ms\ntdll.mak <- to build
> nmake -f ms\ntdll.mak test <- to test if build was successful
> nmake -f ms\ntdll.mak install <- to install openSSL






Posted by Dansoonie
Are you trying to add some new functionality to WebKit? To be more specific, to WebCore? Moreover, are you adding new files to the project to do your work?

If this is what you are doing, and you are having some problems using the new and delete operator and building under debug mode(in visual studio), you might find your answer to your question here.

So the problem is...(at least my problem was)
The project does not build under debug mode because of compile errors related to the new and delete operator.

If you are keep getting compile error messages like the following on the lines using the new or delete operator...

error C2064: term does not evaluate to a function taking 0 arguments

try including "config.h" in the very first line of the file. i.e. #include "config.h"

So, how did this solution come about??? The project is set to use precompiled headers when Building under debug mode in Visual Studio. The precompiled header file name is set to be WebCorePrefix.h. In WebCorePrefix.h you can see something like this...

#ifdef __cplusplus

#define new ("if you use new/delete make sure to include config.h at the top of the file"())

#define delete ("if you use new/delete make sure to include config.h at the top of the file"())

#endif

Honestly, I'm not sure what those lines mean... I mean, the words inside the parenthesis are definitely not comments... I'm not a real hard core programmer and I'm not used to using preprocessors intensively. However, those two lines gave me the clue... I just followed the instructions...

I added #include "config.h" to the files that I just added which has the new and delete operators and problem solved !!!

Thank God... I'm able to code again... this problem has been keeping me crazy for the past week...



Posted by Dansoonie
요새 컴퓨터 속도의 증가로, 소프트웨어를 디자인 하는데 있어서 퍼포먼스의 측면보다는 유지 관리 보수를 하는데 초점을 맞춘 디자인을 하는 경향이 있다고 한다. 그렇다고 퍼포먼스를 전혀 신경쓰지 않을수는 없겠지만, 예전에 비해서는 퍼포먼스의 측면을 덜 따지기 시작했다는 뜻일 것이다...

성질 급하신 분들을 위해서 이 글에 대한 설명을 먼저 하자면...
내가 최근에 봉착한 문제는 정말 쥐꼬리만큼의 퍼포먼스의 이득을 보기 위해서 사용한 inline function들이, 코드의 portability를 떨어뜨리는 결과를 낳게 되었다는 것이다... 아직까지는 내 추측이지만, 그 문제 때문에 이틀간의 삽질이 계속되었다...

나는 현재 다른 사람이 짜놓은 프로그램에 어떤 기능을 추가하는 일을 하고 있다. 그 과정을 좀 쉽게 하기 위해서 꼼수를 써서, 기존에 없던 가상의 layer를 구현 함으로써 그 layer를 통해서 원래 하고자 하는 함수들을 호출하게 하고, 그 과정에서 내가 새로 추가해야 하는 기능들을 구현하기로 하였다. 회사에서 하는 일이라서 구체적으로 어떤 일을 하고 있는지 말하기는 좀 그렇다... 하지만 도식적으로 나타내자면 대충 이렇다...



어쨌든, 문제는 이랬다...
하나의 layer를 추가하게 됨에 다라서 함수 호출하는 일이 더 많아지기 때문에 추가된 함수 호출에 의한 overhead를 최소한으로 줄이기 위해서 나는 inline이라는 키원드를 사용해서 내가 구현한 부분은 main()에서 호출할때 inline으로 호출하도록 하였다. 퍼포먼스의 영향을 많이 주지 못할것을 뻔히 알면서 그냥 뭔가 있어보이려고 시도했다... 하지만 계속 빌드를 하면 최종 결과물인 so(shared object) file을 linking하여 생성할때 내가 추가한 함수들에 대한 reference를 찾을 수 없다는 것이다. ㅡ.ㅡ;

이틀간 삽질 끝에 곰곰히 생각해보다가... 막연히 결과물이 shared object file이라는 점과 내가 inline을 사용했다는 점이 떠올라 inline keyword를 모두 지워버렸더니 그런 linking 에러가 없어져버렸다는... 물론 그 문제가 어느정도 해결되면서 다른 build error들이 발생하였지만, 이틀간 거의 밤새고 그 문제를 태클하던 터라 일단 쉬기로 하였었다...

한숨 자고 친구 결혼식 다녀와서 집에 내려가서 쉬다 왔는데도 오늘 하루종일 졸렸다... 지금도 일하러 사무실에 나왔는데, 배만 고프고 졸립다 ㅜ.ㅜ;


어쨌든, 그러니까 inline function을 사용한 것이 shared object library를 생성하는데 문제가 된다면, inlining은 code의 portability에 문제를 가지고 온다는 말인데... 내가 생각한 문제가 맞긴 맞나? 문제를 찾긴 찾은거 같은데, 아무리 결과가 shared object library file이지만, inline이 문제가 되나??? build하는 방식에 문제가 있나??? 좀더 확인해 봐야 할 것이 많은데도 불구하고, 졸립고 피곤하고 배고프고 귀칞아서 일단은, 누군가 이 문제에 대해서 글을 써서 트랙백을 달아주거나 리플을 기다려보고, 나중에 더 파고들어봐야겠다...

아~ 석사학위까지 있는데, 참으로 부끄럽다... 
고수님들 알려주세요 ㅡ.ㅡ;
Orz     
Posted by Dansoonie