News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Using C++ library with masm

Started by TouEnMasm, August 16, 2012, 05:05:04 AM

Previous topic - Next topic

TouEnMasm


You try to use a c++ lib:
First you translate the .h who define the prototypes.
Headinc (the translator) made the job and you have now a masm header file.
Yuou Try it but you are ennoying by some functions not usable.
Suspect than some of them are written in decorated form in the library.
Masm couldn't find them but he can call them with the proper definitions.
It is the goal of this tool.
======================================================
Use dumpbin /ALL on the library (c++ express dumpbin)
You have now a file describing those functions.
Give the two files to the tool.
He write a new file,with the needed definitions by masm.
Use this file as new header.
Fa is a musical note to play with CL

Vortex

Hi ToutEnMasm,

Thanks for the tool. Did you try Agner Fog's objconv to replace the decorated symbols?

TouEnMasm

I haven't try it.but it seems to do manything,perhaps too much.
I will have a look at it.
Fa is a musical note to play with CL

TouEnMasm

I had a look on obconv:
Quote

Object file converter version 2.14 for x86 and x86-64 platforms.
Copyright (c) 2011 by Agner Fog. Gnu General Public License.

Usage: objconv options inputfile [outputfile]

Options:
-fXXX[SS]  Output file format XXX, word size SS. Supported formats:
           PE, COFF, ELF, OMF, MACHO

-fasm      Disassemble file (-fmasm, -fnasm, -fyasm, -fgasm)

-dXXX      Dump file contents to console.
           Values of XXX (can be combined):
           f: File header, h: section Headers, s: Symbol table,
           r: Relocation table, n: string table.

-xs        Strip exception handling info and other incompatible info.
-xp        Preserve exception handling info and other incompatible info.

-nu        change symbol Name Underscores to the default for the target format.
-nu-       remove Underscores from symbol Names.
-nu+       add Underscores to symbol Names.
-nd        replace Dot/underscore in section names.
-nr:N1:N2  Replace symbol Name N1 with N2.
-ar:N1:N2  make Alias N2 for existing public name N1.
-np:N1:N2  Replace symbol Prefix N1 with N2.
-nw:N1     make public symbol Name N1 Weak (ELF and MAC64 only).
-nl:N1     make public symbol Name N1 Local (invisible).

-lx        eXtract all members from Library.
-lx:N1:N2  eXtract member N1 from Library to file N2.
-ld:N1     Delete member N1 from Library.
-la:N1:N2  Add object file N1 to Library as member N2.
           All library options need -fXXX option.
           Alternative: -lib LIBRARYNAME OBJECTFILENAMES.

-vN        Verbose options. Values of N:
           0: Silent, 1: Print file names and types, 2: Tell about conversions.

-wdNNN     Disable Warning NNN.
-weNNN     treat Warning NNN as Error. -wex: treat all warnings as errors.
-edNNN     Disable Error number NNN.
-ewNNN     treat Error number NNN as Warning.

-h         Print this help screen.

@RFILE     Read additional options from response file RFILE.


Example:
objconv -felf32 -nu filename.obj filename.o

With those options i couldn't see how he can help.
Perhaps modifying the c++ library ?
One idea ?

He comes with his source code.Vc++ express is able to compile it without problems.
It's a good source of informations on Pe format,disassembling...




Fa is a musical note to play with CL

Vortex

Modifying the object modules :

-nr:N1:N2  Replace symbol Name N1 with N2.