I'm Building a user mode component modeled on the user component of minispy
As I understand this, I need to build this with BUILD tool.

The bit that I'm building will be a DLL that will hook up to other stuff...
So when I use BUILD and the OSR ddkbuild tool in a very generic way,
specifing TARGETNAME=NvDrvComm
TARGETTYPE=DYNLINK
UMTYPE=windows
USE_MSVCRT=1


C_DEFINES=$(C_DEFINES) -DUNICODE -D_UNICODE -DNVDRVCOMM_EXPORTS

LINKLIBS=$(SDK_LIB_PATH)\shell32.lib

INCLUDES=$(INCLUDES); \
$(IFSKIT_INC_PATH); \
$(DDK_INC_PATH); \
..\inc

TARGETLIBS=$(TARGETLIBS) \
$(IFSKIT_LIB_PATH)\fltLib.lib \
$(IFSKIT_LIB_PATH)\kernel32.lib \
$(IFSKIT_LIB_PATH)\ntdll.lib

SOURCES=NvDrvComm.cpp\
NvDrvComm.rc

!if "$(DDK_TARGET_OS)"=="WinLH"
_NT_TARGET_VERSION=$(_NT_TARGET_VERSION_WINXP)
!endif

But the build is complaining that it cannot find the DEF file. This creates
an error. I built a DEF file by hand and that stopped the BUILD from
complaining about the missing def file.

BUT this project is on going and if I'm already using the declspec
attributes for the things I need to export, why is BUILD complaining about
the DEF file?

I'd hate to think that I'll need to rewrite the def file everytime I want to
add another export!?

--
Gak -
Finecats

Re: build utility by Maxim

Maxim
Wed Apr 18 09:02:37 CDT 2007

> BUT this project is on going and if I'm already using the declspec
> attributes for the things I need to export, why is BUILD complaining about
> the DEF file?

Abandon __declspec(dllexport) (they are evil :-) ) and use DEF instead.

Reason: __declspec can only export mangled names, like _MyFunc@8 for __stdcall
C routine. This is ugly.

__declspec is justified only with C++ classes exported (like in MFC), but this
can have other implications.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com


Re: build utility by Calvin

Calvin
Wed Apr 18 12:14:19 CDT 2007

Exactly.

--
Calvin Guan
Broadcom Corporation
Connecting Everything(r)

"Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
news:OzDr1IcgHHA.4260@TK2MSFTNGP03.phx.gbl...
>> BUT this project is on going and if I'm already using the declspec
>> attributes for the things I need to export, why is BUILD complaining
>> about
>> the DEF file?
>
> Abandon __declspec(dllexport) (they are evil :-) ) and use DEF instead.
>
> Reason: __declspec can only export mangled names, like _MyFunc@8 for
> __stdcall
> C routine. This is ugly.
>
> __declspec is justified only with C++ classes exported (like in MFC), but
> this
> can have other implications.
>
> --
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> maxim@storagecraft.com
> http://www.storagecraft.com
>



Re: build utility by cristalink

cristalink
Wed Apr 18 15:48:03 CDT 2007

I never use DEF files. They are ugly.

#pragma comment( linker, "/EXPORT:MyFunc=_MyFunc@8" ) is much more
convenient.



"Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
news:OzDr1IcgHHA.4260@TK2MSFTNGP03.phx.gbl...
>> BUT this project is on going and if I'm already using the declspec
>> attributes for the things I need to export, why is BUILD complaining
>> about
>> the DEF file?
>
> Abandon __declspec(dllexport) (they are evil :-) ) and use DEF instead.
>
> Reason: __declspec can only export mangled names, like _MyFunc@8 for
> __stdcall
> C routine. This is ugly.
>
> __declspec is justified only with C++ classes exported (like in MFC), but
> this
> can have other implications.
>
> --
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> maxim@storagecraft.com
> http://www.storagecraft.com
>



Re: build utility by usfinecats

usfinecats
Thu Apr 19 10:42:01 CDT 2007

Ok, this looks good! Am I still using LoadLibary, GetProcAddress or does
this solve the linking problem by getting .lib files to make sense?
--
Gak -
Finecats


"cristalink" wrote:

> I never use DEF files. They are ugly.
>
> #pragma comment( linker, "/EXPORT:MyFunc=_MyFunc@8" ) is much more
> convenient.
>
>
>
> "Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
> news:OzDr1IcgHHA.4260@TK2MSFTNGP03.phx.gbl...
> >> BUT this project is on going and if I'm already using the declspec
> >> attributes for the things I need to export, why is BUILD complaining
> >> about
> >> the DEF file?
> >
> > Abandon __declspec(dllexport) (they are evil :-) ) and use DEF instead.
> >
> > Reason: __declspec can only export mangled names, like _MyFunc@8 for
> > __stdcall
> > C routine. This is ugly.
> >
> > __declspec is justified only with C++ classes exported (like in MFC), but
> > this
> > can have other implications.
> >
> > --
> > Maxim Shatskih, Windows DDK MVP
> > StorageCraft Corporation
> > maxim@storagecraft.com
> > http://www.storagecraft.com
> >
>
>
>

Re: build utility by cristalink

cristalink
Thu Apr 19 15:22:53 CDT 2007

Sorry, I was referring to DEF files, not to your original question. The
pragma below allows to export functions or data from a DLL from the source
files as opposed to DEF.



"usfinecats" <usfinecats@nospam.nospam> wrote in message
news:CDAA772D-5EFD-403A-A388-584D914036CA@microsoft.com...
> Ok, this looks good! Am I still using LoadLibary, GetProcAddress or does
> this solve the linking problem by getting .lib files to make sense?
> --
> Gak -
> Finecats
>
>
> "cristalink" wrote:
>
>> I never use DEF files. They are ugly.
>>
>> #pragma comment( linker, "/EXPORT:MyFunc=_MyFunc@8" ) is much more
>> convenient.
>>
>>
>>
>> "Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
>> news:OzDr1IcgHHA.4260@TK2MSFTNGP03.phx.gbl...
>> >> BUT this project is on going and if I'm already using the declspec
>> >> attributes for the things I need to export, why is BUILD complaining
>> >> about
>> >> the DEF file?
>> >
>> > Abandon __declspec(dllexport) (they are evil :-) ) and use DEF instead.
>> >
>> > Reason: __declspec can only export mangled names, like _MyFunc@8 for
>> > __stdcall
>> > C routine. This is ugly.
>> >
>> > __declspec is justified only with C++ classes exported (like in MFC),
>> > but
>> > this
>> > can have other implications.
>> >
>> > --
>> > Maxim Shatskih, Windows DDK MVP
>> > StorageCraft Corporation
>> > maxim@storagecraft.com
>> > http://www.storagecraft.com
>> >
>>
>>
>>



Re: build utility by Maxim

Maxim
Thu Apr 19 16:01:34 CDT 2007

DEF's advantage is that you have the list of all your exports in a separate
distinct file.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com

"cristalink" <cristalink@nospam.nospam> wrote in message
news:ev8%23DCsgHHA.4904@TK2MSFTNGP05.phx.gbl...
> Sorry, I was referring to DEF files, not to your original question. The
> pragma below allows to export functions or data from a DLL from the source
> files as opposed to DEF.
>
>
>
> "usfinecats" <usfinecats@nospam.nospam> wrote in message
> news:CDAA772D-5EFD-403A-A388-584D914036CA@microsoft.com...
> > Ok, this looks good! Am I still using LoadLibary, GetProcAddress or does
> > this solve the linking problem by getting .lib files to make sense?
> > --
> > Gak -
> > Finecats
> >
> >
> > "cristalink" wrote:
> >
> >> I never use DEF files. They are ugly.
> >>
> >> #pragma comment( linker, "/EXPORT:MyFunc=_MyFunc@8" ) is much more
> >> convenient.
> >>
> >>
> >>
> >> "Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
> >> news:OzDr1IcgHHA.4260@TK2MSFTNGP03.phx.gbl...
> >> >> BUT this project is on going and if I'm already using the declspec
> >> >> attributes for the things I need to export, why is BUILD complaining
> >> >> about
> >> >> the DEF file?
> >> >
> >> > Abandon __declspec(dllexport) (they are evil :-) ) and use DEF instead.
> >> >
> >> > Reason: __declspec can only export mangled names, like _MyFunc@8 for
> >> > __stdcall
> >> > C routine. This is ugly.
> >> >
> >> > __declspec is justified only with C++ classes exported (like in MFC),
> >> > but
> >> > this
> >> > can have other implications.
> >> >
> >> > --
> >> > Maxim Shatskih, Windows DDK MVP
> >> > StorageCraft Corporation
> >> > maxim@storagecraft.com
> >> > http://www.storagecraft.com
> >> >
> >>
> >>
> >>
>
>


Re: build utility by cristalink

cristalink
Thu Apr 19 17:12:48 CDT 2007

The trouble is that DEF is harder to maintain, say, when you delete or add a
function or change the number of parameters. If I want to get the list of
current exports, DUMPBIN /EXPORTS works just fine.



"Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
news:%23fUoiXsgHHA.4892@TK2MSFTNGP03.phx.gbl...
> DEF's advantage is that you have the list of all your exports in a
> separate
> distinct file.
>
> --
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> maxim@storagecraft.com
> http://www.storagecraft.com
>
> "cristalink" <cristalink@nospam.nospam> wrote in message
> news:ev8%23DCsgHHA.4904@TK2MSFTNGP05.phx.gbl...
>> Sorry, I was referring to DEF files, not to your original question. The
>> pragma below allows to export functions or data from a DLL from the
>> source
>> files as opposed to DEF.
>>
>>
>>
>> "usfinecats" <usfinecats@nospam.nospam> wrote in message
>> news:CDAA772D-5EFD-403A-A388-584D914036CA@microsoft.com...
>> > Ok, this looks good! Am I still using LoadLibary, GetProcAddress or
>> > does
>> > this solve the linking problem by getting .lib files to make sense?
>> > --
>> > Gak -
>> > Finecats
>> >
>> >
>> > "cristalink" wrote:
>> >
>> >> I never use DEF files. They are ugly.
>> >>
>> >> #pragma comment( linker, "/EXPORT:MyFunc=_MyFunc@8" ) is much more
>> >> convenient.
>> >>
>> >>
>> >>
>> >> "Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
>> >> news:OzDr1IcgHHA.4260@TK2MSFTNGP03.phx.gbl...
>> >> >> BUT this project is on going and if I'm already using the declspec
>> >> >> attributes for the things I need to export, why is BUILD
>> >> >> complaining
>> >> >> about
>> >> >> the DEF file?
>> >> >
>> >> > Abandon __declspec(dllexport) (they are evil :-) ) and use DEF
>> >> > instead.
>> >> >
>> >> > Reason: __declspec can only export mangled names, like _MyFunc@8 for
>> >> > __stdcall
>> >> > C routine. This is ugly.
>> >> >
>> >> > __declspec is justified only with C++ classes exported (like in
>> >> > MFC),
>> >> > but
>> >> > this
>> >> > can have other implications.
>> >> >
>> >> > --
>> >> > Maxim Shatskih, Windows DDK MVP
>> >> > StorageCraft Corporation
>> >> > maxim@storagecraft.com
>> >> > http://www.storagecraft.com
>> >> >
>> >>
>> >>
>> >>
>>
>>
>



Re: build utility by Maxim

Maxim
Fri Apr 20 03:42:46 CDT 2007

> The trouble is that DEF is harder to maintain, say, when you delete or add a
> function

Add the line to the file.

>or change the number of parameters

DEF does not include this info, no need to update it.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com