The MASM Forum

General => The Campus => Topic started by: Michael on April 08, 2014, 01:56:50 AM

Title: help about including C lib files
Post by: Michael on April 08, 2014, 01:56:50 AM
hello all,
i wonder if it's possible to include a C lib file in MASM.
currently i have a C lib file which require uuid.lib oldnames.lib libc.lib
i tried copying these lib files from VC6.0 into my MASM project folder. but MASM couldn't compile my asm file, reporting dozens of "unresolved external symbol"
what can i do?
Title: Re: help about including C lib files
Post by: Gunther on April 08, 2014, 02:46:38 AM
Hi Michael,

Quote from: Michael on April 08, 2014, 01:56:50 AM
hello all,
i wonder if it's possible to include a C lib file in MASM.
currently i have a C lib file which require uuid.lib oldnames.lib libc.lib
i tried copying these lib files from VC6.0 into my MASM project folder. but MASM couldn't compile my asm file, reporting dozens of "unresolved external symbol"
what can i do?
I'm not sure if I understand your question right. But a library (lib file) is a number of different object files. You have to import the correct names (attention: often case sensitive) of the procedures you want to use (call). These are the "unresolved external symbols".

Please have a look into the examples section of MASM32. There are a lot of examples which show the apropriate import of external symbols.

Welcome to the forum.

Gunther
Title: Re: help about including C lib files
Post by: dedndave on April 08, 2014, 02:58:10 AM
also.....

the names are very likely decorated
in the masm32 package, Hutch has created an INC file for MSVCRT (masm32\include\msvcrt.inc)
you might be interested to have a look at that

it's not, strictly speaking, the best example, because MsVcrtxx.dll is a runtime library
but, you will see some decorated names, nonetheless

Erol (Vortex) is one guy that may be able to help you out   :t
he probably has tools that will help

http://vortex.masmcode.com/ (http://vortex.masmcode.com/)

"MS COFF Object file undecorator V1.1"
Title: Re: help about including C lib files
Post by: qWord on April 08, 2014, 03:21:49 AM
Quote from: Michael on April 08, 2014, 01:56:50 AMcurrently i have a C lib file which require uuid.lib oldnames.lib libc.lib
i tried copying these lib files from VC6.0 into my MASM project folder.
Instead of copying the libs you should specify the VC library directory when linking (option /LIBPATH:"C:\xyz\VC\lib").
Title: Re: help about including C lib files
Post by: ragdog on April 08, 2014, 03:43:17 AM
Can you upload your project ?
Title: Re: help about including C lib files
Post by: Vortex on April 08, 2014, 04:39:48 AM
Hi Michael,

Welcome to the forum.

Did you specify correctly the C function prototypes?
Title: Re: help about including C lib files
Post by: Michael on April 08, 2014, 08:22:21 PM
thank you all. i added below lines in my asm file and now it works.

includelib   \masm32\lib\hid.lib
includelib   \vc\lib\kernel32.lib
includelib   \vc\lib\setupapi.lib
includelib   \vc\lib\msvcrt.lib
includelib   \vc\lib\uuid.lib
includelib   \vc\lib\oldnames.lib
includelib   \vc\lib\libc.lib

i found that the libc.lib kernel32.lib msvcrt.lib files in masm32 didn't work in this case, while the ones in vc folder work.