DDK build utility query: How to copy some of the files before compilation begins?

Hi All,
I am using DDKs, build utility to build driver and apps.
Some of the .c (utility) files that were compiled along with driver sources,
need to be used in my apps as well.
so, in the file *sources*, when I give the relative path to those files, say
…..\utils\genericutils.c, I am getting an error, “invalid prefex…”

Hence, I am thinking I will copy it to the current directory from the
relative path before compilation begins. *In which build file can I include
these operations*?

I know building them as seperate libraries and linking will help. There are
more complications associated with it.

I have chosen the option of copying because I feel, this can be done faster.

-Madhsudhana

Hi,

the DDK build utility will not allow any such prefixes except for the immediate parent and the current directory IIRC. You might, however, be able to sneak in an action inside makefile.inc.

Alternately you could use ddkbuild.cmd which offers hook scripts before setting the environment, before build and after build.

I have chosen the option of copying because I feel, this can be done
faster.
Remember that your method of copying has to retain the time stamps of the file, because that is how nmake determines whether the object files need to be rebuild (in fact most make implementations work like that).

// Oliver


DDKWizard and DDKBUILD: http:

Trunk (potentially unstable) version: http:</http:></http:>

A lib is by far the most preferable chpice. Why is that off the table? Anyways, for your 2nd copy of genericutils.c you can do this

#include “…..\utils\genericutils.c”

And get the same results without custom build commands

d


From: Madhusudan Narayan
Sent: Thursday, January 07, 2010 12:14 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] DDK build utility query: How to copy some of the files before compilation begins?

Hi All,
I am using DDKs, build utility to build driver and apps.
Some of the .c (utility) files that were compiled along with driver sources, need to be used in my apps as well.
so, in the file sources, when I give the relative path to those files, say …..\utils\genericutils.c, I am getting an error, “invalid prefex…”

Hence, I am thinking I will copy it to the current directory from the relative path before compilation begins. In which build file can I include these operations?

I know building them as seperate libraries and linking will help. There are more complications associated with it.

I have chosen the option of copying because I feel, this can be done faster.

-Madhsudhana

— 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

You also could just assign a symbolic link and make the same source files
show up in multiple directories.

Jan

Hi All,

I am using DDKs, build utility to build driver and apps.

Some of the .c (utility) files that were compiled along with driver sources,
need to be used in my apps as well.

so, in the file sources, when I give the relative path to those files, say
…..\utils\genericutils.c, I am getting an error, “invalid prefex…”

Hence, I am thinking I will copy it to the current directory from the
relative path before compilation begins. In which build file can I include
these operations?

I know building them as seperate libraries and linking will help. There are
more complications associated with it.

I have chosen the option of copying because I feel, this can be done faster.

Jan Bottorff wrote:

You also could just assign a symbolic link and make the same source
files show up in multiple directories.

Only on Vista and above. XP only does symbolic links for directories.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

> -----Original Message-----

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Tim Roberts
Sent: Thursday, January 07, 2010 9:34 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] DDK build utility query: How to copy
some of the files before compilation begins?

> You also could just assign a symbolic link and make the same source
> files show up in multiple directories.
>

Only on Vista and above. XP only does symbolic links for directories.

Anyway, it doesn’t seem as a good idea. Build would work on one machine
and doesn’t work on others. Everything necessary for build should be
visible from sources so using “include link”(#include
“…..\whatever.c”) is better, although still ugly. Library is the best
if build has to be used.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]

Thanks every one for suggesting solutions.
I am going to use #include “…'....\genericuti.c” approach for my solution
for now.
and I do consider lib solution after some time.

-Madhu

On Fri, Jan 8, 2010 at 4:10 AM, Michal Vodicka wrote:

> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Tim Roberts
> > Sent: Thursday, January 07, 2010 9:34 PM
> > To: Windows System Software Devs Interest List
> > Subject: Re: [ntdev] DDK build utility query: How to copy
> > some of the files before compilation begins?
> >
> > > You also could just assign a symbolic link and make the same source
> > > files show up in multiple directories.
> > >
> >
> > Only on Vista and above. XP only does symbolic links for directories.
>
> Anyway, it doesn’t seem as a good idea. Build would work on one machine
> and doesn’t work on others. Everything necessary for build should be
> visible from sources so using “include link”(#include
> “…..\whatever.c”) is better, although still ugly. Library is the best
> if build has to be used.
>
> Best regards,
>
> Michal Vodicka
> UPEK, Inc.
> [xxxxx@upek.com, http://www.upek.com]
>
> —
> 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
>

Anyway, it doesn’t seem as a good idea. Build would work on one machine and doesn’t work on others.

True, and although hard links would work on any version of Windows, they would suffer from the same problem and more problematically, some source control systems would end up rendering a hard linked file as a separate file when checked out.

Good luck,

mm

Hi,
I built a static lib out of the files that are generic. This static lib is
built using visual studio.

Then,
I had to modify the app(test app) that will be built using build utility.
So I edited the file called sources. Added my new UTILITILIBS.lib to
TARGETLIBS

Now, if I build the app, it gives me linkage error, unresolved external
symbols, say, _Custom_func@16 etc.

Note that, all the files in the lib and my test app are all .c files. and
when I did dumpbin of my lib, I see only functions names without mangling.
eg, _Custom_func.(without @ sign or whatever).

Even the function declarations in header files are have #ifdef __cplusplus
extern"C"{ …

Why is the app expecting mangled function names? and How do I fix it?

-Madhu

On Fri, Jan 8, 2010 at 5:23 PM, wrote:

> Anyway, it doesn’t seem as a good idea. Build would work on one machine and
> doesn’t work on others.
>
> True, and although hard links would work on any version of Windows, they
> would suffer from the same problem and more problematically, some source
> control systems would end up rendering a hard linked file as a separate file
> when checked out.
>
> Good luck,
>
> mm
>
> —
> 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
>

VS defaults to one calling convention (stdcall i think), the wdk to another (cdecl). You need to match the wdk’s convention.

d

tiny phone keyboard + fat thumbs = you do the muth


From: Madhusudan Narayan
Sent: Wednesday, January 13, 2010 1:52 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] DDK build utility query: How to copy some of the files before compilation begins?

Hi,
I built a static lib out of the files that are generic. This static lib is built using visual studio.

Then,
I had to modify the app(test app) that will be built using build utility.
So I edited the file called sources. Added my new UTILITILIBS.lib to TARGETLIBS

Now, if I build the app, it gives me linkage error, unresolved external symbols, say, _Custom_func@16 etc.

Note that, all the files in the lib and my test app are all .c files. and when I did dumpbin of my lib, I see only functions names without mangling. eg, _Custom_func.(without @ sign or whatever).

Even the function declarations in header files are have #ifdef __cplusplus extern"C"{ …

Why is the app expecting mangled function names? and How do I fix it?

-Madhu

On Fri, Jan 8, 2010 at 5:23 PM, > wrote:
Anyway, it doesn’t seem as a good idea. Build would work on one machine and doesn’t work on others.

True, and although hard links would work on any version of Windows, they would suffer from the same problem and more problematically, some source control systems would end up rendering a hard linked file as a separate file when checked out.

Good luck,

mm


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

— 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

wow!!! super!!!
It was __stdcall by default in Visual studio. I changed it to __cdecl.
It’s working perfectly fine now.

Thanks a lot for the valuable assistance.

-Madhusudhana

On Wed, Jan 13, 2010 at 8:45 PM, Doron Holan wrote:

> VS defaults to one calling convention (stdcall i think), the wdk to
> another (cdecl). You need to match the wdk’s convention.
>
> d
>
> tiny phone keyboard + fat thumbs = you do the muth
>
>
>
>
> ------------------------------
> From: Madhusudan Narayan
> Sent: Wednesday, January 13, 2010 1:52 AM
> To: Windows System Software Devs Interest List
>
> Subject: Re: [ntdev] DDK build utility query: How to copy some of the
> files before compilation begins?
>
> Hi,
> I built a static lib out of the files that are generic. This static lib is
> built using visual studio.
>
>
> Then,
> I had to modify the app(test app) that will be built using build utility.
> So I edited the file called sources. Added my new UTILITILIBS.lib to
> TARGETLIBS
>
> Now, if I build the app, it gives me linkage error, unresolved external
> symbols, say, _Custom_func@16 etc.
>
> Note that, all the files in the lib and my test app are all .c files. and
> when I did dumpbin of my lib, I see only functions names without mangling.
> eg, _Custom_func.(without @ sign or whatever).
>
> Even the function declarations in header files are have #ifdef __cplusplus
> extern"C"{ …
>
> Why is the app expecting mangled function names? and How do I fix it?
>
>
> -Madhu
>
>
> On Fri, Jan 8, 2010 at 5:23 PM, wrote:
>
>> Anyway, it doesn’t seem as a good idea. Build would work on one machine
>> and doesn’t work on others.
>>
>> True, and although hard links would work on any version of Windows, they
>> would suffer from the same problem and more problematically, some source
>> control systems would end up rendering a hard linked file as a separate file
>> when checked out.
>>
>> Good luck,
>>
>> mm
>>
>> —
>> 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
>>
>
> — 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
>
> —
> 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
>

The public header file for your library that declares the function
prototypes should explicitly declare the linkage of the functions as well.

Your solution of just changing VS to use __cdecl just hides the issue.
Your real problem is that you have independently built components with an
under-specified ?public? linkage between them.

Fix the header file. Then it will not matter how these two independent
components are built.

Good Luck,
Dave Cattley

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Madhusudan Narayan
Sent: Saturday, January 16, 2010 6:12 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] DDK build utility query: How to copy some of the files
before compilation begins?

wow!!! super!!!
It was __stdcall by default in Visual studio. I changed it to __cdecl.
It’s working perfectly fine now.

Thanks a lot for the valuable assistance.

-Madhusudhana
On Wed, Jan 13, 2010 at 8:45 PM, Doron Holan
wrote:
VS defaults to one calling convention (stdcall i think), the wdk to another
(cdecl). You need to match the wdk’s convention.

d

tiny phone keyboard + fat thumbs = you do the muth

The different calling conventions causing this issue have already been
explained. Why build the library using a different tool though? There
could be good reasons (such as its being developed by a different group)
but if you’re building it yourself why not just use the WDK build?

Madhusudan Narayan wrote:

Hi,
I built a static lib out of the files that are generic. This static lib
is built using visual studio.

Then,
I had to modify the app(test app) that will be built using build utility.
So I edited the file called sources. Added my new UTILITILIBS.lib to
TARGETLIBS

Now, if I build the app, it gives me linkage error, unresolved external
symbols, say, _Custom_func@16 etc.

Note that, all the files in the lib and my test app are all .c files.
and when I did dumpbin of my lib, I see only functions names without
mangling. eg, _Custom_func.(without @ sign or whatever).

Even the function declarations in header files are have #ifdef
__cplusplus extern"C"{ …

Why is the app expecting mangled function names? and How do I fix it?