static library with DDK

Hi,
I am trying to build a static library with the help of DDK. The lib file is created, but none of the function is exportd. This is how my source file look like

int DoSomething()
{

return 0;
}

and this is how my sources file look like

TARGETNAME=mylib
TARGETTYPE=LIBRARY

UMTYPE=console

UMBASE=0x1000000

TARGETPATH=obj

INCLUDES=$(BASEDIR)\inc;

TARGETLIBS=$(DDK_LIB_PATH)\setupapi.lib

SOURCES=myfile.cpp

I have checked the created library with

#dumpbin /EXPORTS mylib.lib

but no functions were listed in the output. What am I dong wrong?

Thanks,

Lloyd


Scanned and protected by Email scanner

Libs do not export functions. They either contain import resolutions or code. Yours contains code. Just link and exe or dl or sys against your lib and you will be fine

d


From: Lloyd
Sent: Monday, December 28, 2009 8:35 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] static library with DDK

Hi,
I am trying to build a static library with the help of DDK. The lib file is created, but none of the function is exportd. This is how my source file look like

int DoSomething()
{

return 0;
}

and this is how my sources file look like

TARGETNAME=mylib

TARGETTYPE=LIBRARY

UMTYPE=console

UMBASE=0x1000000

TARGETPATH=obj

INCLUDES=$(BASEDIR)\inc;

TARGETLIBS=$(DDK_LIB_PATH)\setupapi.lib

SOURCES=myfile.cpp

I have checked the created library with

#dumpbin /EXPORTS mylib.lib

but no functions were listed in the output. What am I dong wrong?

Thanks,

Lloyd

______________________________________
Scanned and protected by Email scanner


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Thanks Doron Holan. When I try to link this library with my usermode
application it gives me unresolved symbol error.

This is how my usermode applicaiton look like

extern “C”
{
int DoSomething();
}
int main()
{
return DoSomething();
}

Then it returns unresolved external symbol “int __cdecl DoSomething(void)” .
I have made necessary library settings in my application like setting the
library path and additional dependencies. This is the linker settings of my
user mode application.

/OUT:“C:\Documents and Settings\Devel\Desktop\test\Debug\test.exe”
/INCREMENTAL /NOLOGO /LIBPATH:“D:\Drivers\temp\objchk_wxp_x86\i386”
/MANIFEST /MANIFESTFILE:“Debug\test.exe.intermediate.manifest” /DEBUG
/PDB:“c:\Documents and Settings\Devel\Desktop\test\debug\test.pdb”
/SUBSYSTEM:CONSOLE /MACHINE:X86 /ERRORREPORT:PROMPT mylib.lib kernel32.lib
user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib
ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

Where could be the problem? Is the static library made with DDK is same as
making a static library using visual studio?
Thanks again,
Lloyd

----- Original Message -----
From: Doron Holan
To: Windows System Software Devs Interest List
Sent: Tuesday, December 29, 2009 10:20 AM
Subject: RE: [ntdev] static library with DDK

Libs do not export functions. They either contain import resolutions or
code. Yours contains code. Just link and exe or dl or sys against your lib
and you will be fine

d


Scanned and protected by Email scanner

Try explicitly specifying your calling conventions. The WDK defaults to __stdcall, whereas VS defaults to __cdecl.

  • S

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Lloyd
Sent: Monday, December 28, 2009 9:11 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] static library with DDK

Thanks Doron Holan. When I try to link this library with my usermode
application it gives me unresolved symbol error.

This is how my usermode applicaiton look like

extern “C”
{
int DoSomething();
}
int main()
{
return DoSomething();
}

Then it returns unresolved external symbol “int __cdecl DoSomething(void)” .
I have made necessary library settings in my application like setting the
library path and additional dependencies. This is the linker settings of my
user mode application.

/OUT:“C:\Documents and Settings\Devel\Desktop\test\Debug\test.exe”
/INCREMENTAL /NOLOGO /LIBPATH:“D:\Drivers\temp\objchk_wxp_x86\i386”
/MANIFEST /MANIFESTFILE:“Debug\test.exe.intermediate.manifest” /DEBUG
/PDB:“c:\Documents and Settings\Devel\Desktop\test\debug\test.pdb”
/SUBSYSTEM:CONSOLE /MACHINE:X86 /ERRORREPORT:PROMPT mylib.lib kernel32.lib
user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib
ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

Where could be the problem? Is the static library made with DDK is same as
making a static library using visual studio?
Thanks again,
Lloyd

----- Original Message -----
From: Doron Holan
To: Windows System Software Devs Interest List
Sent: Tuesday, December 29, 2009 10:20 AM
Subject: RE: [ntdev] static library with DDK

Libs do not export functions. They either contain import resolutions or
code. Yours contains code. Just link and exe or dl or sys against your lib
and you will be fine

d


Scanned and protected by Email scanner


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Thank you very much… I have explicitly specified the calling convention,
and now it works…

Thanks again,
Lloyd

----- Original Message -----
From: “Skywing”
To: “Windows System Software Devs Interest List”
Sent: Tuesday, December 29, 2009 10:53 AM
Subject: RE: [ntdev] static library with DDK

> Try explicitly specifying your calling conventions. The WDK defaults to
> stdcall, whereas VS defaults to cdecl.
>
> - S
>

______________________________________
Scanned and protected by Email scanner

> Thanks Doron Holan. When I try to link this library with my usermode

application it gives me unresolved symbol error.

The default for VC++ is __cdecl calling convention, the WDK’s default is __stdcall.

Please provide explicit calling convention specs in the header file of your library.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

Thank you very much, that solved the problem…

> Thanks Doron Holan. When I try to link this library with my usermode
> application it gives me unresolved symbol error.

The default for VC++ is __cdecl calling convention, the WDK’s default is
__stdcall.

Please provide explicit calling convention specs in the header file of
your library.


Scanned and protected by Email scanner