News:

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

Main Menu

Convert VC++ library to masm?

Started by Redlabel, May 22, 2013, 06:13:31 AM

Previous topic - Next topic

Redlabel

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

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

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--

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.

Redlabel

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


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

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

i do not understand.

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

i uploaded the library here

http://rghost.net/46180829

dedndave

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

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

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
        INCLUDE    cryptlib.inc
        INCLUDELIB cryptlib.lib

TouEnMasm


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

dedndave

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

Quote from: dedndave on May 23, 2013, 02:11:58 AMand, 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

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