Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / August 2003

Tip: Looking for answers? Try searching our database.

Syntax of DllImport's EntryPoint field

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Wu YiFei - 28 Aug 2003 08:43 GMT
Hi,

I try to call c function in C#,What is the syntax of
DllImport's EntryPoint field?
Why some of extern method need to point out this field
while some of them do not need?

In my project,
A C function defination is
//****************
__declspec(dllexport) SbVec2s
SoWinFullVwrGetViewportRegionSizePixels(SoWinFullViewer*
pViewer);
//****************

The corresponding C# wrapper is
//****************
[DllImport
("InventorCD.dll",CallingConvention=CallingConvention.Cdecl
,EntryPoint="?SoWinFullVwrGetViewportRegionSizePixels@@YA?
AVSbVec2s@@PAVSoWinFullViewer@@@Z")]
protected static extern SbVec2s
SoWinFullVwrGetViewportRegionSizePixels(System.IntPtr
pViewer);
//****************

The code is fine to run.

But when I try to change the C function defination to
//*****************
__declspec(dllexport) SbVec2s
SoWinFullVwrGetViewportRegionSizePixels(SoWinFullViewer*
pViewer, int iTest);
//*****************

Making no change to the C# wrapper, calling the C# wrapper
will throw exception as,
"
An unhandled exception of
type 'System.EntryPointNotFoundException' occurred in
openinventor.net.dll

Additional information: Unable to find an entry point
named ? in DLL InventorCD.dll.
"
I think I should modify the DllImport.EntryPoint value,
but how to do it? the working code is got from somewhere
else, not written by me.

Thanks,
Wu YiFei
Vadim Melnik - 28 Aug 2003 09:14 GMT
Hi,

> But when I try to change the C function defination to
> //*****************
[quoted text clipped - 16 lines]
> but how to do it? the working code is got from somewhere
> else, not written by me.

Seems like EntryPoint field should be updated, it's due to the fact C
decorated name used, and after function parameters changed, decorated name
changed as well. For example run the following command line:

undname
?SoWinFullVwrGetViewportRegionSizePixels@@YA?AVSbVec2s@@PAVSoWinFullViewer@@
@Z

it outputs:

Undecoration of :-
"?SoWinFullVwrGetViewportRegionSizePixels@@YA?AVSbVec2s@@PAVS
oWinFullViewer@@@Z"
is :- "class SbVec2s __cdecl SoWinFullVwrGetViewportRegionSizePixels(class
SoWin
FullViewer *)"

See "dumpbin /EXPORTS " or Dependens VS tool allow to find exported function
name.

..
Regards,
Vadim.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.