News:

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

Main Menu

Linking problem

Started by shaikkareem, October 03, 2014, 06:19:10 PM

Previous topic - Next topic

shaikkareem

Hello every one...while reading specification of COM on msdn i want to do some accessing thing in provided shell32.dll or in some in- process servers. So by default as you all know about com we need guids of classes and interfaces built in them to make use of them...but for now i want to access shell32.dll server's classes and interfaces...for that most or all of their guids are provided in uuid.lib file in ms sdk dir. So the problem is how to link this lib file for resolving extranal references with my asm file...

jj2007

By including it maybe?

include \masm32\include\masm32rt.inc
includelib "C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib\Uuid.Lib"

.code
AppName db "Masm32:", 0

start: MsgBox 0, "Hello World", addr AppName, MB_OK
exit

ExternDef BHID_Filter:DWORD
mov eax, BHID_Filter  ; just a test

end start

shaikkareem

Thanks jj.., i did that early but no use... at ml.exe stage where still showing that the symbols are undefined...
Is there any way to link it with my prog externally...?

Gunther

Hi shaikkareem,

could you post the critical code, please? So we can test it and find the errors.

Gunther
You have to know the facts before you can distort them.

jj2007

Quote from: shaikkareem on October 03, 2014, 06:54:50 PM
Thanks jj.., i did that early but no use... at ml.exe stage where still showing that the symbols are undefined...
Is there any way to link it with my prog externally...?

You need to define them, as I did tentatively with the ExternDef
Often, you need only a few, so you can dig into the *.h and translate them "by hand". Otherwise, search the forum for header threads posted by vortex

dedndave

uuid.lib is filled with numerous GUID's and CLSID's
as far as i know, it has no code or other data in it
generally, you can google the specific one you want and add it to the data section

shaikkareem

Thanks ded and jj but as you said defining them manually or googling them and entering in data section is not good as you think, i had tried that way but most of that given bad result...simply googling with CLSID_ or IID_  prefixes dont give result as my experience. Could you guys know an utility which explores the content of a lib file so that i get the ids encoded in uuid and then manually drfine them....?

dedndave

well - the library (libraries, actually - there are a few different ones) is designed for use with the MS C compilers
the compiler code "knows" which GUID's are in the library

but, you can use Erol's lib2def tool to generate a list of exports
from that DEF file, you can easily make an include file

http://vortex.masmcode.com/

wouldn't be hard to write a little program to dump the contents   :P

TouEnMasm


correct syntax
includelib uuid.lib ;or another
EXTERNDEF  IID_MYIID:GUID

Fa is a musical note to play with CL

Gunther

Hi Dave,

Quote from: dedndave on October 04, 2014, 12:47:57 AM
but, you can use Erol's lib2def tool to generate a list of exports
from that DEF file, you can easily make an include file

http://vortex.masmcode.com/

that's the way to go. By the way, Erol's tool is very helpful.

Gunther
You have to know the facts before you can distort them.

dedndave

i guess i could write a little program to dump the contents of these libraries
then, you can grab the one you need and add it to your code
there are other similar libraries besides uuid.lib, like dxguid, wbemuuid, wiaguid, etc

TouEnMasm

here a mixed content of further uuid lib,syntax masm
Fa is a musical note to play with CL

shaikkareem

Guys really your help is appreciable and the vortex tools are very helpfull to solve my problem with libraries inclussion ... i used the tools available at vortex page and had overcome the problem. Now the ml.exe and link.exe recognizing the extranal symbols provided in prog.
Genarally used lib2inc .exe which generated a uuid.inc file, and i included both the .lib and .inc versions of uuid and the error was no longer appeared during compilation and execution. :icon14: