Link problem

Hello,

I just renamed my .c files into .cpp and compiled again. I get a lot(24)
link errors LNK2001and LNK2019. Even DriverEntry is not found. I know a
lot of programmers probably had this problem, so please help me with
this. What do I have to do to fix this problem?


Thank you,
Andrei Ciubotaru

DriverEntry must be declared as extern “C”

Bill Wandel

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com]
On Behalf Of Andrei Ciubotaru [Hardwired]
Sent: Saturday, October 22, 2005 2:54 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Link problem

Hello,

I just renamed my .c files into .cpp and compiled again. I get a lot(24)
link errors LNK2001and LNK2019. Even DriverEntry is not found. I know a lot
of programmers probably had this problem, so please help me with this. What
do I have to do to fix this problem?


Thank you,
Andrei Ciubotaru


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@bwandel.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Wrap ntddk.h in extern “C”{} like this:

#ifdef __cplusplus
extern “C” {
#endif
#include <ntddk.h>
#ifdef __cplusplus
extern “C” {
#endif

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

----- Original Message -----
From: “Andrei Ciubotaru [Hardwired]”
To: “Windows System Software Devs Interest List”
Sent: Saturday, October 22, 2005 10:54 PM
Subject: [ntdev] Link problem

> Hello,
>
> I just renamed my .c files into .cpp and compiled again. I get a lot(24)
> link errors LNK2001and LNK2019. Even DriverEntry is not found. I know a
> lot of programmers probably had this problem, so please help me with
> this. What do I have to do to fix this problem?
>
> –
> Thank you,
> Andrei Ciubotaru
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com</ntddk.h>

> Wrap ntddk.h in extern “C”{} like this:
… and do the same for DriverEntry like this:

extern “C” NTSTATUS DriverEntry(…) …

Regards,
Alex Shvedov

----- Original Message -----
From: “Maxim S. Shatskih”
To: “Windows System Software Devs Interest List”
Sent: Saturday, October 22, 2005 5:09 PM
Subject: Re: [ntdev] Link problem

> Wrap ntddk.h in extern “C”{} like this:
>
> #ifdef cplusplus
> extern “C” {
> #endif
> #include <ntddk.h>
> #ifdef
cplusplus
> extern “C” {
> #endif
>
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
> ----- Original Message -----
> From: “Andrei Ciubotaru [Hardwired]”
> To: “Windows System Software Devs Interest List”
> Sent: Saturday, October 22, 2005 10:54 PM
> Subject: [ntdev] Link problem
>
>
>> Hello,
>>
>> I just renamed my .c files into .cpp and compiled again. I get a lot(24)
>> link errors LNK2001and LNK2019. Even DriverEntry is not found. I know a
>> lot of programmers probably had this problem, so please help me with
>> this. What do I have to do to fix this problem?
>>
>> –
>> Thank you,
>> Andrei Ciubotaru
>>
>>
>> —
>> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>>
>> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@bellsouth.net
> To unsubscribe send a blank email to xxxxx@lists.osr.com
></ntddk.h>

name mangling might be causing problems. The driverentry needs to be
declared in extern C directive.

amitrajit