Author Topic: Convert VC++ library to masm?  (Read 21825 times)

Redlabel

  • Guest
Convert VC++ library to masm?
« on: May 22, 2013, 06:13:31 AM »
Hee folks

got a simple and short question

is it possible to use a ms vc++ 2010 .library file in winasm masm?
i got only the *.lib file generated by vc++ 2010.

just using the "uselib" macro won't work because of some missing *.obj files error or something, dont know because i dont have object files, just a *.lib.

jj2007

  • Member
  • *****
  • Posts: 10543
  • Assembler is fun ;-)
    • MasmBasic
Re: Convert VC++ library to masm?
« Reply #1 on: May 22, 2013, 07:06:15 AM »
The uselib macro requires two files:

include \masm32\include\*.inc
includelib \masm32\lib\*.lib

Do you have an inc file, too? Is it located in the right folder?

The best solution to get help would be to zip the library and include files together with a hello world example. You are not giving much information...

dedndave

  • Member
  • *****
  • Posts: 8827
  • Still using Abacus 2.0
    • DednDave
Re: Convert VC++ library to masm?
« Reply #2 on: May 22, 2013, 08:04:42 AM »
i would imagine you are missing a proper masm-syntax include file
masm does not understand C .h includes

which LIB are you trying to use ?
there may already be a masm INC file made for it, someplace

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 7537
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Convert VC++ library to masm?
« Reply #3 on: May 22, 2013, 01:57:19 PM »
It depends on what the libraries are, if they are C++ libraries you will have problems with the name mangling where if they are plain C libraries, they can be used if you create a set of prototypes for it in MASM format. What you will normally find is if you use the C runtime libraries you pick up most of their overhead as well and there will be little if any gain by building the app in MASM. Alternately you can routinely use separate C object modules if you prototype them correctly and use the right calling convention for them.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

Redlabel

  • Guest
Re: Convert VC++ library to masm?
« Reply #4 on: May 22, 2013, 04:09:59 PM »
thanks for the reply's guys.

i dont have a inc file. also i think it is a plain c++ library.

im trying to include the latest Crypto++ library.

TouEnMasm

  • Member
  • *****
  • Posts: 1341
    • EditMasm
Re: Convert VC++ library to masm?
« Reply #5 on: May 22, 2013, 07:21:16 PM »

use this to have the include file:
http://masm32.com/board/index.php?topic=576.0
Just take care that a c++ library use a defaut prototype  PROTO C.
You can have need to change "PROTO" to "PROTO C".
You can also find decorated functions names,use it on the translated header if it is the case.

Fa is a musical note to play with CL

ragdog

  • Member
  • ****
  • Posts: 610
Re: Convert VC++ library to masm?
« Reply #6 on: May 22, 2013, 08:39:01 PM »
It very work to convert the header *.h to include
I use tools for it h2incx or a translator from ToutEnMasm

and the rest of the converted Include make it per hand


need you more help post this crypto lib
or tell us what you need for a crypto many cryptos give allready masm includes

Redlabel

  • Guest
Re: Convert VC++ library to masm?
« Reply #7 on: May 23, 2013, 12:26:26 AM »
i do not understand.

i do not need inc files, i just want to use this library into masm

i uploaded the library here

Code: [Select]
http://rghost.net/46180829

dedndave

  • Member
  • *****
  • Posts: 8827
  • Still using Abacus 2.0
    • DednDave
Re: Convert VC++ library to masm?
« Reply #8 on: May 23, 2013, 12:58:05 AM »
true - you don't NEED inc files
but, it is the easiest way to prototype the functions in the lib
one of the guys may make an inc file for you
if not, i may do it, later
Erol (Vortex) has several nice tools for doing this automatically

http://vortex.masmcode.com/

Andreas (Japheth) also has a tool called h2incX

http://www.japheth.de/h2incX.html

it was designed for C, not C++, but it's worth a shot

dedndave

  • Member
  • *****
  • Posts: 8827
  • Still using Abacus 2.0
    • DednDave
Re: Convert VC++ library to masm?
« Reply #9 on: May 23, 2013, 01:10:11 AM »
by the way,
it would simplify creation of the inc file if you knew you were only using a few functions from the lib
you only need to prototype and typedef the symbols you are going to use

also, there are crypto routines written in masm
you may find that they are faster - and easier to use in a masm program   :biggrin:

dedndave

  • Member
  • *****
  • Posts: 8827
  • Still using Abacus 2.0
    • DednDave
Re: Convert VC++ library to masm?
« Reply #10 on: May 23, 2013, 01:16:47 AM »
here is a quicky inc file
i used Erol's lib2def and def2inc
it only defines the prototypes for functions
not sure how well it will work, but you can give it a try


in your asm source
Code: [Select]
        INCLUDE    cryptlib.inc
        INCLUDELIB cryptlib.lib

TouEnMasm

  • Member
  • *****
  • Posts: 1341
    • EditMasm
Re: Convert VC++ library to masm?
« Reply #11 on: May 23, 2013, 01:59:11 AM »

There is something wrong,
dumpbin find 2925 functions exported by the dll
Fa is a musical note to play with CL

dedndave

  • Member
  • *****
  • Posts: 8827
  • Still using Abacus 2.0
    • DednDave
Re: Convert VC++ library to masm?
« Reply #12 on: May 23, 2013, 02:11:58 AM »
probably a problem with dumpbin   :biggrin:
i doubt it is set up to handle C++

and, i doubt the crypto library has that many functions - lol
you can find cryptlib.h online - it wouldn't be that hard to create an inc file by hand - it's pretty small

qWord

  • Member
  • *****
  • Posts: 1473
  • The base type of a type is the type itself
    • SmplMath macros
Re: Convert VC++ library to masm?
« Reply #13 on: May 23, 2013, 02:24:18 AM »
and, i doubt the crypto library has that many functions
yes, instead it has several thousand methods: http://www.cryptopp.com/docs/ref/annotated.html
MREAL macros - when you need floating point arithmetic while assembling!

TouEnMasm

  • Member
  • *****
  • Posts: 1341
    • EditMasm
Re: Convert VC++ library to masm?
« Reply #14 on: May 23, 2013, 02:46:59 AM »
Quote
probably a problem with dumpbin   
i doubt it is set up to handle C++
Of course it is the dumpbin of the c++,not the masm32 one.
Perhaps a use of the wincrypt (.h .sdk) will be more simple.
Fa is a musical note to play with CL