全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:3309
推到 Plurk!
推到 Facebook!

欲使用Build好的so檔, 卻不能執行

尚未結案
chrono
一般會員


發表:1
回覆:11
積分:2
註冊:2003-11-25

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-11-25 16:18:21 IP:61.220.xxx.xxx 未訂閱
各位大大好:    小弟寫了一個so檔後... 想要另寫一個程式來使用它... 將so檔include進project後... build也過了... 但要執行時卻出現底下錯誤訊息... Project Project1 received signal SIGSEGV(11). Process stopped. Use Step or Run to continue. 請問要如何解決... 之前有寫過一個so檔可以使用... 這個so檔跟之前的那個有一個差別在於使用了 不知道是不是因為這個的緣故... 麻煩大家了...謝謝啦...
william
版主


發表:66
回覆:2535
積分:3048
註冊:2002-07-11

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-11-25 16:21:52 IP:147.8.xxx.xxx 未訂閱
Make sure you do not use the VCL unit (e.g. Graphics, Forms, Printers, etc)
chrono
一般會員


發表:1
回覆:11
積分:2
註冊:2003-11-25

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-11-25 16:30:57 IP:61.220.xxx.xxx 未訂閱
不好意思... 用到了HTML Tag... "這個so檔跟之前的那個有一個差別在於使用了 clx.h"
chrono
一般會員


發表:1
回覆:11
積分:2
註冊:2003-11-25

發送簡訊給我
#4 引用回覆 回覆 發表時間:2003-11-25 16:34:08 IP:211.22.xxx.xxx 未訂閱
Yes... I have used TBitmap (because I have to read .bmp and .jpg) Is there any solution for me to use this component? Thanks a lot!
william
版主


發表:66
回覆:2535
積分:3048
註冊:2002-07-11

發送簡訊給我
#5 引用回覆 回覆 發表時間:2003-11-25 16:53:22 IP:147.8.xxx.xxx 未訂閱
Oh... Kylix C ... for Kylix (Delphi), uses QGraphics if you misued Graphics... I think C should be similar, don't use Graphics, Forms, Printers and use QGraphics, QPrinters, QForms instead.
chrono
一般會員


發表:1
回覆:11
積分:2
註冊:2003-11-25

發送簡訊給我
#6 引用回覆 回覆 發表時間:2003-11-26 13:39:59 IP:211.22.xxx.xxx 未訂閱
I have used QGraphics.hpp, but still have another problem. I have seen it in previous article, but it is not solved.    [Linker Fatal Error] Fatal: Unable to open file 'SysInit.o'    According to previous article, I have installed all development tools in my RedHat9, including Kernel development, X software development, GNOME, and KDE development. It's a strange problem, because I can run my source code but can't build .so file.
chrono
一般會員


發表:1
回覆:11
積分:2
註冊:2003-11-25

發送簡訊給我
#7 引用回覆 回覆 發表時間:2003-11-26 13:40:12 IP:61.220.xxx.xxx 未訂閱
I have used QGraphics.hpp, but still have another problem. I have seen it in previous article, but it is not solved.    [Linker Fatal Error] Fatal: Unable to open file 'SysInit.o'    According to previous article, I have installed all development tools in my RedHat9, including Kernel development, X software development, GNOME, and KDE development. It's a strange problem, because I can run my source code but can't build .so file.
chrono
一般會員


發表:1
回覆:11
積分:2
註冊:2003-11-25

發送簡訊給我
#8 引用回覆 回覆 發表時間:2003-11-26 14:34:44 IP:211.22.xxx.xxx 未訂閱
Sorry, I had made a mistake.  >
william
版主


發表:66
回覆:2535
積分:3048
註冊:2002-07-11

發送簡訊給我
#9 引用回覆 回覆 發表時間:2003-11-26 16:54:29 IP:147.8.xxx.xxx 未訂閱
I am glad that you find the solution  >
chrono
一般會員


發表:1
回覆:11
積分:2
註冊:2003-11-25

發送簡訊給我
#10 引用回覆 回覆 發表時間:2003-11-28 09:50:21 IP:61.220.xxx.xxx 未訂閱
I have tried to code a small program to load image by TBitmap in QGraphics.hpp, and the error signal still exists. Maybe Kylix still has bugs or I can't use QGraphics in this way, so I give up to use this component. Now, I have to read BMP and JPG by some open source codes or by myself. Thank you for your help, Mr. william!  >
william
版主


發表:66
回覆:2535
積分:3048
註冊:2002-07-11

發送簡訊給我
#11 引用回覆 回覆 發表時間:2003-11-28 10:33:05 IP:147.8.xxx.xxx 未訂閱
I have tried to create a simple application on both Kylix Delphi and C++ and have no problem in loading a bitmap using TBitmap  href="http://mitglied.lycos.de/AndreasHausladen/Delphi/Kylix/CLXPatches/">http://mitglied.lycos.de/AndreasHausladen/Delphi/Kylix/CLXPatches/ P.S. I have not applied the patch since my use of Kylix on Linux is for fun only
chrono
一般會員


發表:1
回覆:11
積分:2
註冊:2003-11-25

發送簡訊給我
#12 引用回覆 回覆 發表時間:2003-11-28 14:57:11 IP:211.22.xxx.xxx 未訂閱
I can also load image by TBitmap, but it will signal an error when I use it in .so file. I build a Share Object project, and select Cpp source type and "use CLX". Write source codes below, and add test.cpp file to project. 1."test.h" extern "C" __declspec(dllexport) void LoadImage(char *filename, unsigned char **outmap); 2."test.cpp" #include "test.h" #include "QGraphics.hpp" const int level = 4; extern "C" __declspec(dllexport) void LoadImage(char* filename, unsigned char **outmap) { TBitmap *image = new TBitmap(); image->LoadFromFile( filename ); outmap = new unsigned char* [image->Height]; for (int i=0; i< image->Height; i ) outmap[i] = new unsigned char [image->Width]; Byte *ptr; for (int i=0; i< image->Height; i ) { ptr = (Byte *)image->ScanLine[i]; for (int j=0; j< image->Width; j ) outmap[i][j] = ptr[level*j]; } delete image; } Select Project->Options... in main menu, and click Packages. Unselect "Build with runtime package". After build this project, add .so file to your test program (add .so file to project, and include "test.h"). When you call LoadImage() in your program and run it, the error signal will show. I have updated VisualCLX you mentioned above, but the error is still happened. ps. My code is just for test, so I don't free the outmap memory and don't check if the filename is an image format. 發表人 - chrono 於 2003/11/28 15:05:44
william
版主


發表:66
回覆:2535
積分:3048
註冊:2002-07-11

發送簡訊給我
#13 引用回覆 回覆 發表時間:2003-11-28 16:17:33 IP:147.8.xxx.xxx 未訂閱
Found this is QForms.pas (not QForms.hpp) line 721:
引言: { Restrictions on CLX and TApplication in external modules: CLX and Qt allow only a single instance of the application object - it is created and destroyed in the initialization and finalization sections of QControls.pas, respectively. It is the user's responsibility when using external modules (packages and libraries or shared objects) in their applications to ensure that only a single instance of TApplication is created. Please heed the following rules when mixing modules that rely on visual CLX: - External libraries (.dll's/.so's) may not refer to visual CLX units directly or indirectly. - If you wish to include visual CLX code in an external library, the external library must be a *package* to avoid duplicate unit initialization and finalization. - If your package uses the visualclx package, the main application must also use it, and should not directly link in visual CLX units. }
Then it explains why... Build with runtime package is required. Personally I don't have Kylix C experience on using package. I do have a project based on packages/shared objects running sucessfully using Kylix Delphi.
chrono
一般會員


發表:1
回覆:11
積分:2
註冊:2003-11-25

發送簡訊給我
#14 引用回覆 回覆 發表時間:2003-12-18 11:42:49 IP:61.220.xxx.xxx 未訂閱
I have solved this problem by an image library(FreeImage) to load image instead of TBitmap. It's usage is not convenient.  I cannot use it to read image data in main program immediately, but I have to use it in another .cpp or .so file. Maybe I should address this question on their forum. 
william
版主


發表:66
回覆:2535
積分:3048
註冊:2002-07-11

發送簡訊給我
#15 引用回覆 回覆 發表時間:2003-12-18 12:23:29 IP:147.8.xxx.xxx 未訂閱
.so can create clx component, I actually has .so creating database component in one of my personal project. The only limitation is you should run the same instance of CLX in both the application and the .so file (i.e. runtime package only).    VCL suffers from this too  >>
系統時間:2024-05-08 23:39:47
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!