symbol decoration

In your header file:

#ifdef __cplusplus{
extern “C”
#endif

__declspec( dllexport ) int IWant2beExported( void );
#ifdef __cplusplus{
}
#endif

And perhaps in your linkers def-file

EXPORTS
IWant2beExported

Keep in mind, that the “dllexport” must be used only if you are linking=

your code to a dll.
I do not think that it’ll make any problems here due to your dynamic
linking approach.

=
=20
LEGAL Francois =
=20
<seo.legal to:>System Software Devs Interest List" =20
> om> =20
Sent by: cc: =
=20
bounce-170308-14814@li Subject: [ntdev] s=
ymbol decoration =20
sts.osr.com =
=20
=
=20
=
=20
18.03.2004 16:32 =
=20
Please respond to =
=20
“Windows System =
=20
Software Devs Interest =
=20
List” =
=20
=
=20
=
=20

I’m trying to do runtime linking (LoadLibrary /GetProcAddress), and the=

call to GetProcAddress fails.

It seems to be caused by the function symbol being strangely decored :
?changeipaddress@@YGJPAPAUIWbemServices@@IPAD1@Z

How must I compile the DLL to get the normal decoration (_funcname@3) ?=

Thanks

Fran=E7ois


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

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

=</seo.legal>

You first of all need to declare any function that is exported to extern
“C”, which will remove all the @@@@, which looks like C++ to me.

This is probably sufficent for the purposes of using GetProcAddress.
However, to make it compatible with the OS calling convention, you’d need
stdcall. The latter is only necessary if you for instance pass this along
as a function pointer to the OS, and the OS uses this function pointer to
call the function in your code.

stdcall is different from __cdecl, i.e. “normal”, in that it the called
function is responsible for removing the arguments, rather than the calling
function.

There is a flag to the compiler to change the calling convention for the
whole file. You will still need to do extern “C” for any function you want
to export.

I think there is a macro to do all this, DLLEXPORT or some such.


Mats

-----Original Message-----
From: LEGAL Francois [mailto:seo.legal@ts.eads.net]
Sent: Thursday, March 18, 2004 3:32 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] symbol decoration

I’m trying to do runtime linking (LoadLibrary /GetProcAddress), and the call
to GetProcAddress fails.
It seems to be caused by the function symbol being strangely decored :
?changeipaddress@@YGJPAPAUIWbemServices@@IPAD1@Z
How must I compile the DLL to get the normal decoration (_funcname@3) ?

Thanks

Fran?ois


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

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

Use

extern “C”
{
VOID MyFunc1(PVOID Parameter);

}

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

----- Original Message -----
From: LEGAL Francois
To: Windows System Software Devs Interest List
Sent: Thursday, March 18, 2004 6:32 PM
Subject: [ntdev] symbol decoration

I’m trying to do runtime linking (LoadLibrary /GetProcAddress), and the call to GetProcAddress fails.

It seems to be caused by the function symbol being strangely decored : ?changeipaddress@@YGJPAPAUIWbemServices@@IPAD1@Z

How must I compile the DLL to get the normal decoration (_funcname@3) ?

Thanks

Fran?ois


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

If GetProcAddress is planned for use - then the non-decorated-at-all version must be used, which is IIRC achievable by .DEF file only.

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

----- Original Message -----
From: xxxxx@3Dlabs.com
To: Windows System Software Devs Interest List
Sent: Thursday, March 18, 2004 6:46 PM
Subject: RE: [ntdev] symbol decoration

You first of all need to declare any function that is exported to extern “C”, which will remove all the @@@@, which looks like C++ to me.

This is probably sufficent for the purposes of using GetProcAddress. However, to make it compatible with the OS calling convention, you’d need stdcall. The latter is only necessary if you for instance pass this along as a function pointer to the OS, and the OS uses this function pointer to call the function in your code.

stdcall is different from __cdecl, i.e. “normal”, in that it the called function is responsible for removing the arguments, rather than the calling function.

There is a flag to the compiler to change the calling convention for the whole file. You will still need to do extern “C” for any function you want to export.

I think there is a macro to do all this, DLLEXPORT or some such.


Mats

-----Original Message-----
From: LEGAL Francois [mailto:seo.legal@ts.eads.net]
Sent: Thursday, March 18, 2004 3:32 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] symbol decoration

I’m trying to do runtime linking (LoadLibrary /GetProcAddress), and the call to GetProcAddress fails.

It seems to be caused by the function symbol being strangely decored : ?changeipaddress@@YGJPAPAUIWbemServices@@IPAD1@Z

How must I compile the DLL to get the normal decoration (_funcname@3) ?

Thanks

Fran?ois


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

You are currently subscribed to ntdev as: xxxxx@3dlabs.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@storagecraft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com