Comment compile un ccp vers un fichier .so

algeriecell -  
algeriecell Messages postés 3 Date d'inscription   Statut Membre Dernière intervention   -
Bonjour,

prière m'aide a compile un fichier ccp vers un fichier .so ( c'est plugin pour dreambox enigma1 )
j'attend toujours vos réponses

salutations

A voir également:

3 réponses

dubcek Messages postés 18789 Date d'inscription   Statut Contributeur Dernière intervention   5 637
 
hello
$ cat hello.c
#include <stdio.h>
void hello(void)
{
	printf("hello\n");
}
$ gcc -E hello.c > hello.cpp
$ gcc -c hello.cpp
$ gcc -shared -Wl,-soname,libhello.so -o libhello.so hello.o
$ file libhell*
libhello.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, not stripped
$ 
0
algeriecell Messages postés 3 Date d'inscription   Statut Membre Dernière intervention  
 
salut mon frere

tu peut ma compile ce fichier vers un fichier .so

c'est important pour mois

salutation
0
dubcek Messages postés 18789 Date d'inscription   Statut Contributeur Dernière intervention   5 637
 
cf post #1
0
algeriecell Messages postés 3 Date d'inscription   Statut Membre Dernière intervention  
 
/*
+--------------------------------------------------------------------------
| Bible Enigma1 Tutorial
| ========================================
| By: Bacicciosat aka Meo aka Luponero
|
| Lesson 8: http connection and download demonstration.
| (c) august 2006 by Meo
|
+---------------------------------------------------------------------------
*/

// include files nedeed by our code.
#include <stdio.h>
#include <stdlib.h>
#include <plugin.h>
#include <math.h>
#include <dirent.h>
#include <string.h>
#include <lib/gui/ewindow.h>
#include <lib/gui/ebutton.h>
#include <lib/gui/emessage.h>
#include <lib/gui/textinput.h>
#include <lib/gui/combobox.h>
#include <lib/gui/statusbar.h>
#include <lib/gui/eskin.h>
#include <lib/gdi/font.h>
#include <lib/gdi/epng.h>
#include <lib/gdi/gfbdc.h>
#include <lib/system/httpd.h>
#include <lib/gui/eprogress.h>
#include <upgrade.h>
#include <iostream>
#include <fstream>
#include <cstdio>
#include <lib/base/thread.h>
#include <lib/base/estring.h>



// The Class declaration of our Http Connection system
class Fetcher : public Object
{
// The temp file in which we will store the download data
eString tempPath;

// internal pointers and functions of download connection
eHTTPConnection * connectionP;
eHTTPDataSource * dataSinkP;
void transferDone(int err);
eHTTPDataSource * createDownloadSink(eHTTPConnection *conn);
public:
Signal1<void,int> downloadDone;
void fetch(eString url);
};

// The Class declaration of our Main Window
class eBibleMainWindow: public eWindow
{
// the label to show the text
eLabel *label;
public:
// the textinput
eTextInputField *mytext;
// the button to start connection
eButton *ok;
// the connection object
Fetcher theFetcher;
// flag to indicate the download state
int downloadDoneFlag;
int inDownloadFlag;
public:
// the constructor.
eBibleMainWindow();
// function to call when button is pushed
void Wconnect();
// function to call when download is completed.
void downloadDone(int err);
// the destructor.
~eBibleMainWindow();
};

// The definition of the C function we will use to remove Html Tags from downloaded text
eString removeTags(eString in);

// The plugin entry point, Here start the code execution
extern "C" int plugin_exec( PluginParam *par )
{
// our demo dialog instance.
eBibleMainWindow dlg;
// show the dialog...
dlg.show();
// give control to dialog.. (the dialog is modal!)
int result=dlg.exec();
// and after it, hide it again.
dlg.hide();
return result;
}


eBibleMainWindow::eBibleMainWindow(): eWindow(1)
{
inDownloadFlag = 0;
// move our dialog to 100.100...
cmove(ePoint(150, 150));
// ...and give x and y dimensions.
cresize(eSize(360, 226));
// set a title.
setText("Wi-Server Activation Code");

// create a label to show a text.
label=new eLabel(this);
// give a position
label->move(ePoint(10, 10));
// set the label dimensions
label->resize(eSize(490, 380));
// set the label text
label->setText("Entrer le Code d Activation :");
// set the wrap flag to the label
label->setFlags(RS_WRAP);


// create textinput
mytext=new eTextInputField(this);
// give position
mytext->move(ePoint(20, 100));
// give size
mytext->resize(eSize(300, 40));
// set max number of characters
mytext->setMaxChars(12);
mytext->setUseableChars("1234567890");
//mytext->setText(codeentry);
// show a frame decoration
mytext->loadDeco();

// create button and set properties
ok = new eButton(this);
ok->setText("Valider");
ok->move(ePoint((clientrect.width() - 150)/2, clientrect.height() - 60));
ok->resize(eSize(150, 40));
ok->setShortcut("green");
ok->setShortcutPixmap("green");
ok->loadDeco();
setFocus(mytext);
// function to call when button is pushed
CONNECT(ok->selected, eBibleMainWindow::Wconnect);
//set focus to textinput

}

void eBibleMainWindow::Wconnect()
{
// Set the flag that indicates we are in downlading status
if(!inDownloadFlag) {
inDownloadFlag = 1;
// Hide Label to change text
label->hide();
// Set new text for the label
label->setText("Veuillez patienter, connexion en cours......");
// Show the label with New Text
label->show();
// Function to call when donwload is complete
CONNECT(theFetcher.downloadDone, eBibleMainWindow::downloadDone);
// Set the flag indicates that we are starting connections
downloadDoneFlag = 0;
// Call function to start http connection
eString url,message2;
message2 = mytext->getText();
url = "http://88.198.223.12/active-code/?actvcode=" + myCode;
theFetcher.fetch(url);
}
}

void Fetcher::fetch(eString url)
{


// assign to the variable the url we want to connect

// assign to class variable the temporary file we will use to store the dowanloaded data
tempPath = "/var/tmp/test.tmp";
// inizialize the control error flag
int error = 0;
// start connection
connectionP = eHTTPConnection::doRequest(url.c_str(), eApp, &error);
// Show a Messagebox in case of connection error
if(!connectionP || error)
{ eMessageBox msg("Error downloading " + url + "(" + eString().sprintf("%d", error) + ")", _("Details"), eMessageBox::btOK);
msg.show(); msg.exec(); msg.hide();
}
else
{
//if the connection is estabilished start the download funcions
CONNECT(connectionP->transferDone, Fetcher::transferDone);
CONNECT(connectionP->createDataSource, Fetcher::createDownloadSink);
// set the user-agent name
connectionP->local_header["User-Agent"] = "PLBOT";
connectionP->start();
}
}

void Fetcher::transferDone(int err)
{
// If no error we can call the downloadDone function
if(!err)
{ connectionP = NULL;
// Tell caller download is ready
/*emit*/ downloadDone(err);
}
else
{
//else show a Messagebox with Error description.
eString sMsg = "Error " + eString().sprintf("%d", err);
eMessageBox msg(sMsg, _("User Abort"), eMessageBox::iconWarning|eMessageBox::btOK);
msg.show(); msg.exec(); msg.hide();
}
}
// internal download procedure (standard)
eHTTPDataSource * Fetcher::createDownloadSink(eHTTPConnection *conn)
{ dataSinkP = new eHTTPDownload(connectionP, (char *)tempPath.c_str());

return(dataSinkP);

}

void eBibleMainWindow::downloadDone(int err)
{
// set the flag that indicates that download is complete
if(!downloadDoneFlag)
{ downloadDoneFlag = 1;
// create a buffer to read the temp file with download data.
char buf[512];
// declare the variables we will use in this function
eString strview, strview1;

// open temporary file cotaining the downloaded data
FILE *f = fopen("/var/tmp/test.tmp", "rt");
FILE *ccf = fopen("/var/etc/cccam.cfg", "w+");
if (f)
{
//Add an introduction text
strview = "ca fonctione ";
// find the line we want (The mkportal definition in the wiki page we downloaded)
while (fgets(buf, 512, f))
{
if (strstr(buf, "oops"))
break;
}
// store this line in the variable
strview1 = eString(buf);
// remove html tags
strview1 = removeTags(strview1);
// concate strings to compose our output text
strview += strview1;
// read the next lines .....
while (fgets(buf, 512, f))
{
// if we found this string the defnition is ended so we can stop to read the file
if (strstr(buf, "See also"))
break;
// else store the line in the variable
strview1 = eString(buf);
// remove html tags
strview1 = removeTags(strview1);
// concate strings to compose our output text
strview += strview1;
}
// close file
fclose(f);
}
//Delete the temporary file we used to store downloaded data
//::unlink("/var/tmp/test.txt");
// Hide label to change the text
label->hide();
// Insert into the label the output we have stored in the variable strview
label->setText(strview);
// Show the label with the new text
label->show();
// hide the connection button
ok->hide();
// set the flag that indicates we are not in download state anymore
inDownloadFlag = 0;

}

}

// This is a normal C++ function to remove the Html Tags from a strng.
// I will not comment this. This is not Enigma. This is normal C++ Programming.
eString removeTags(eString in)
{ eString out;
int startpos = 0; int length = 0;
for(unsigned int i = 0; i < in.length(); i++)
{ length++;
if(in.mid(i, 1) == "<")
{ out = out + in.mid(startpos, length - 1);
for(unsigned int j = i; j < in.length(); j++)
{ if(in.mid(j, 1) == ">")
{ i = j;
startpos = i + 1;
length = 0;
break;
}
}
}
}
if(out == "")
{ out = in;
}
return out;
}



eBibleMainWindow::~eBibleMainWindow()
{
// we have to do almost nothing here. all widgets are automatically removed
// since they are child of us. the eWidget-destructor will to this for us.
}
0