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 / October 2004

Tip: Looking for answers? Try searching our database.

Calling C++ library function from C# ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Christophe - 20 Oct 2004 15:27 GMT
Hello,

I would like to call unmanaged code (C++ Library Code) in C# library.

When I Call C++ Function with an "int" parameter.
It seems that there is a Marshalling problem; because when I put 88 as
parameter,
My C++ function receives 1240420

How to keep same parameter value between C# code and VC++ Code ?

To explain my problem, I can send a very simple example.
Mattias Sj?gren - 20 Oct 2004 15:52 GMT
Please post relevant parts of your native and managed code.

Mattias

Signature

Mattias Sjögren [MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Mario Cobretti - 21 Oct 2004 08:19 GMT
When u import the function, u must know that int type in C is short in C#. And may be you have to use "ref short myvariable"  if it is a pointer to int.

> Hello,
>
[quoted text clipped - 8 lines]
>
> To explain my problem, I can send a very simple example

Rate this thread:







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.