More Group Sites
School Rankings
Jobless Net
Better Home
Enviro++


Help | Subscribe/Unsubscribe | Rules | Other Group Sites: Better Education | Better Education Forum
Welcome Guest Search | Active Topics | Members | Log In | Register

Duplicate 'DllImport' attribute Options · View
hong
Posted: Friday, November 06, 2009 4:59:14 PM

Rank: Administration
Groups: Administration

Joined: 11/23/2008
Posts: 335
Points: 711
Location: Australia
Duplicate 'DllImport' attribute

The error occurs when two 'DllImport' attributes are placed next to each other without specifying the staic extern function - the attributed method exposed by an unmanaged dynamic-link library (DLL) as a static entry point. For example,
Code:
        [DllImport("decrypt.dll", EntryPoint = "_GetSerialRegData"/*, ExactSpelling = false*/, SetLastError=true)]
        [DllImport("decrypt.dll", EntryPoint = "_GetActivationCode"/*, ExactSpelling = false*/, SetLastError = true)]
        static extern void GetSerialRegData(...);
        static extern void GetActivationCode(...);


So don't separate the attributed method:
Code:
        [DllImport("decrypt.dll", EntryPoint = "_GetSerialRegData"/*, ExactSpelling = false*/, SetLastError=true)]
        static extern void GetSerialRegData(...);
        [DllImport("decrypt.dll", EntryPoint = "_GetActivationCode"/*, ExactSpelling = false*/, SetLastError = true)]
        static extern void GetActivationCode(...);



Sponsor
Posted: Friday, November 06, 2009 4:59:14 PM
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

ASPNET Theme created by Boskone (Dan Ferguson)
Powered by Yet Another Forum.net version 1.9.1.8 (NET v2.0) - 3/29/2008
Copyright © 2003-2008 Yet Another Forum.net. All rights reserved.
This page was generated in 0.051 seconds.