You work as the application developer at Certkiller .com.
You are working on an application and want to use platform
invoke services to call an unmanaged function from managed code.
How will you accomplish the task?

Answer Posted / gaaa

A. Create a class to store DLL functions. Create prototype
methods by using the managed code.
B. Use COM to register the assembly. Reference the managed
code from COM.
C. Export a type library for the managed code.
D. Import a type library as an assembly. Create instances of
COM object.

Answer: A

Explanation: It is good practice to wrap the messy P-Invoke
code with a .net class.
The main benefit is to keep the client code tidy as the
messy and cryptic code will be hidden away. Also better for
maintenance e.g dll name or version changes.
The question explicitly says the unmanaged code should be
called with platform invoke services. Importing\exporting a
type library is relevant for interoperation with COM.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you do to install a new Windows 2003 R2 DC in a Windows 2003 AD?

1900


Hi, I want to do asp.net certification. So please guide me how i can proceed.

2568


Which is best insistute to learn IIS 6.0 and 7.0

2478


HOW TO USE FSMO ROLES IN FOREST.. MEANS IF WE HAVE A THREE DOAMINS IN FOREST .....THEY R HYD.COM(FIRST ONE....PRIMARY DOMAIN IN THE FOREST),BANG.COM (SECOND DOMAIN),CSD.COM(THIRD DOMAIN). I WANT TO IMPLEMENT FSMO ROLES IN THIRD DOMAIN HOW TO IMPLEMENT IT ...MEANS HOW TO CONNECT WITH DOAMIN AND WHAT ROLES WE IMPLEMENT..

2667


mcse 2003 to mcitp upgrade paper

3141






Can you connect Active Directory to other 3rd-party Directory Services? Name a few options.

3069


HI Guys...... Good day ahead How many sub domains can be added in exchange server means in a domain

2415


Which is best among dotnet and dotnet diploma? Friends Please answer this question as soon as possible.

2042


Hi can any one help me for 70-562 dumps?

2583


How do you create a new application partition

2187


windows file/folder sharing ?

2129


is the cogent cyber solution trainig centre best for .net course?

2365


What are application partitions? When do I use them

1978


I want to clear the mcse in 2007. So could i get the latest dump of msce questions?

2143


What are sites? What are they used for?

3010