|
RE: lug-bg: c/c++ differences
- Subject: RE: lug-bg: c/c++ differences
- From: ico-lugbg@email.domain.hidden (Ico)
- Date: Fri, 4 Jul 2003 13:18:40 +0300
Hi,
Probwaj dali ne te ustrojwa towa (za C++):
extern "C" int plugin_main
{
}
Za da se preglatne ot C kompilatora shte trqbwa da naprawish uslowna
kompilaciq I malko macrosi.
Pozdrawi,
Ico
-----Original Message-----
From: owner-lug-bg_at_linux-bulgaria.org
[mailto:owner-lug-bg_at_linux-bulgaria.org] On Behalf Of Stanislav Lechev
[AngelFire]
Sent: Friday, July 04, 2003 12:12 PM
To: lug-bg_at_linux-bulgaria.org
Subject: lug-bg: c/c++ differences
<p>-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
// da se chete ot po naprednali c/c++ programisti
zdrawejte move bi ne e naj prawilnoto mqsto za maila mi no wse pak shte se
probwam w momenta pisha plugin baziran demon ... ideqta e da zarevda plugini
koito da obsluvwat razni neshtica... znachi problema mi e sledniq
eto edna primerna c/c++ programa:
int plugin_main() {
}
- -------
eto kakwo se poluchawa pri kompilirane sys C kompilator
root_at_angelfire:[0]:utils# gcc qwe.c -c root_at_angelfire:[0]:utils# objdump -t
qwe.o
qwe.o: file format elf32-i386
SYMBOL TABLE:
00000000 l df *ABS* 00000000 qwe.c
00000000 l d .text 00000000
00000000 l d .data 00000000
00000000 l d .bss 00000000
00000000 l d .comment 00000000
00000000 g F .text 00000005 plugin_main
<p>waven e posledniq red w sluchaq imeto na funkciqta e "plugin_main" kakto se
wivda i ot symbol tabel-a
eto kakwo stawa sys C++:
root_at_angelfire:[0]:utils# g++ qwe.c -c root_at_angelfire:[0]:utils# objdump -t
qwe.o
qwe.o: file format elf32-i386
SYMBOL TABLE:
00000000 l df *ABS* 00000000 qwe.c
00000000 l d .text 00000000
00000000 l d .data 00000000
00000000 l d .bss 00000000
00000000 l d .comment 00000000
00000000 g F .text 00000005 _Z11plugin_mainv
kakto wivdame w C++ funkciqta e sys ime "_Z11plugin_mainv" koeto weroqtno e
zaradi polimorfizma ili pone taka si go obqsnqwam az ... wyprosa mi e
sledniq
kogato se opitwam da zaredq plugina si ...
az napraktika ne mu znam imenata na funkciite
kogato sa kompilirani na C++
znam che ima wariant sys dummy funkcii prez C da go prekaram
no ne me ustrojwa...
interesnoto e che na razlichnite versii na libc/glibc
tezi prefix i suffix: _Z11 i v
sa razlichni...
wyprosa mi e kak po dqwolite da si adresiram prawilno funkciqta sled kato ne
znam imeto i...
za momenta sym si reshil problema po sledniq nachin
oshte ot configure scripta
si izpylnqwam edno perl scriptche koeto kompilira takawa
malka programka i parswa rezultata ot objdump-a
po tozi nachin wadq prefix i suffix koito wkarwam s DEFINE-owe w programata
si... ne che ne stawa po tozi nachin no mi se wivda mnogo dyrweno... 10x in
advance...
- --
- -=#=-=#=-=#=-=#=-=#=-=#=-=#=-=#=-=#=-=#=-=#=-=#=-=#=-=#=-=#=-=#=-
Regards, AngelFire
Stanislav Lechev <firedust_at_vega.bg>
PGP Key: http://firedust.vega.bg/pgp/StanislavLechev.asc
Vega Internet Service Provider (tm) -- http://www.vega.bg
- -=#=-=#=-=#=-=#=-=#=-=#=-=#=-=#=-=#=-=#=-=#=-=#=-=#=-=#=-=#=-=#=-
<p>-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQE/BUT28RPXBhiMqewRAjhJAKCLC9OcPw166EI3TeTgZ5/J0MCTxACfVSiI
VUW6ZL90gWHdhuF+YRD3Sbs=
=aZph
-----END PGP SIGNATURE-----
============================================================================
A mail-list of Linux Users Group - Bulgaria (bulgarian linuxers).
http://www.linux-bulgaria.org - Hosted by Internet Group Ltd. - Stara Zagora
To unsubscribe: http://www.linux-bulgaria.org/public/mail_list.html
============================================================================
============================================================================
A mail-list of Linux Users Group - Bulgaria (bulgarian linuxers).
http://www.linux-bulgaria.org - Hosted by Internet Group Ltd. - Stara Zagora
To unsubscribe: http://www.linux-bulgaria.org/public/mail_list.html
============================================================================
|
|
|