Re: [fpc-pascal] C++ Name Mangling

2007-03-15 Thread Felipe Monteiro de Carvalho

On 3/15/07, Matt Emson [EMAIL PROTECTED] wrote:

Does Symbian use PE?


Yes, Symbian uses PE.


You might not like what I'm about to say, but writing a C wrapper around the
C++ and then linking the Pascal code to the C wrapper is a far, far safer
way to get consistent results.


Ummm ... I would like to avoid that, but it seams that it´s easier to
use a c wrapper in fact.

--
Felipe Monteiro de Carvalho
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] C++ Name Mangling

2007-03-15 Thread Felipe Monteiro de Carvalho

One thing that just came to me is writting a c wrapper, but don´t put
it on a DLL. Instead compile it into a object files, and link them.

This way I have the portability of a c wrapper, but I don´t need
external DLLs =)

--
Felipe Monteiro de Carvalho
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] C++ Name Mangling

2007-03-15 Thread Matt Emson
 Does Symbian use PE?
 Yes, Symbian uses PE.

Symbian : EPOC 32 by another name ;-)

 Ummm ... I would like to avoid that, but it seams that it´s easier to
 use a c wrapper in fact.

The effort is larger, but you really do get a more stable and portable
solution. It doesn't tie you to a specific language too, so should someone
want to use another language (?what I don't know?) they could still use your
wrapper. You might even find some one would *pay* you to use it. You never
know ;-)

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] C++ Name Mangling

2007-03-14 Thread Felipe Monteiro de Carvalho

Hello,

Does anyone know a good way to find out the name of a exported method on C++

I am trying to link to C++ from Symbian OS. The method is declared like this:

class User : public UserHeap
   {
public:
.
   IMPORT_C static TInt InfoPrint(const TDesC aDes);

Normally I would guess it´s:

_ZN4User2InfoPrintEc

Or something similar. But it doesn´t work.

Any other ideas? I tryed to open the .lib file with a HEX editor to
search for _ZN, or other strings that would reveal the mangled name,
but it was futile.

thanks a lot,

Felipe

PS: My God, it´s a headache to link to c++
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] C++ Name Mangling

2007-03-14 Thread leslie . polzer
On Wed, Mar 14, 2007 at 08:28:00PM +0100, Felipe Monteiro de Carvalho
wrote:

 Any other ideas? I tryed to open the .lib file with a HEX editor to
 search for _ZN, or other strings that would reveal the mangled name,
 but it was futile.
Try the demangling code from valgrind...

  Leslie


-- 
NEW homepage: https://viridian.dnsalias.net/~sky/homepage/
gpg --keyserver pgp.mit.edu --recv-keys DD4EBF83


pgp5C1P8DnLp1.pgp
Description: PGP signature
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] C++ Name Mangling

2007-03-14 Thread Felipe Monteiro de Carvalho

On 3/14/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

Try the demangling code from valgrind...


I took a look at valgrind website, and it seams to only work on Linux.
Is that right?

The Symbian SDK only works on Windows, so they cannot be utilized together.

thanks,
--
Felipe Monteiro de Carvalho
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] C++ Name Mangling

2007-03-14 Thread Daniël Mantione


Op Wed, 14 Mar 2007, schreef Felipe Monteiro de Carvalho:

 On 3/14/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  Try the demangling code from valgrind...
 
 I took a look at valgrind website, and it seams to only work on Linux.
 Is that right?
 
 The Symbian SDK only works on Windows, so they cannot be utilized together.

Not that C++ name mangling differs per compiler and per compiler version. 
Depending on what compiler the Symbian SDK uses, Valgrind code migth not 
be useable at all.

Daniël Mantione___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] C++ Name Mangling

2007-03-14 Thread Felipe Monteiro de Carvalho

On 3/14/07, Daniël Mantione [EMAIL PROTECTED] wrote:

Not that C++ name mangling differs per compiler and per compiler version.
Depending on what compiler the Symbian SDK uses, Valgrind code migth not
be useable at all.


The SDK uses CodeWarrior C++ for the emulator. With some lucky it is
compatible with GCC with respect to the name mangling.

--
Felipe Monteiro de Carvalho
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] C++ Name Mangling

2007-03-14 Thread Felipe Monteiro de Carvalho

Ok folks,

I made this question on the Symbian forum and got an answer =)

One can use the Linker to create a dump file with all exported names.
The command is the following:

mwldsym2 -S -show names,verbose
C:\Programas\Symbian\UIQ3SDK\epoc32\release\winscw\udeb\euser.lib

And the function I was looking for is called: [EMAIL 
PROTECTED]@@SAHABVTDesC16@@@Z

Bizarre, neh?

Now that name isn´t a valid identifier for GNU Assembler ... but I
should probably ask about that on a GNU As group.

thanks a lot,
--
Felipe Monteiro de Carvalho
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal