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

Tip: Looking for answers? Try searching our database.

Managed c++ calling unmanaged dll with LoadLibrary

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
vikrantca - 03 Dec 2004 23:39 GMT
Hello,
I have a unmanaged fortran dll that Iam trying to load using LoadLibrary
from manged c++. I have to use loadlibrary, since I dont know the path to the
dll until runtime.

I can load the library, get the function pointers etc., but when I call a
function in the dll, the function succeeds, but the registers in the current
functions corrupted.

For example

void someManagedCppFunction( int *var1 , int *var2) {

// call fortran dll function via function pointer
//  v1 and v2 are different than Var1 and var2

double v1, v2;

int k = fp(v1,v2);

// At this point the  the pointers var1 and var2 are displayed as undefined
values.

}

Your help is apprecited.
thank you.
vikrantca
Mattias Sj?gren - 05 Dec 2004 12:05 GMT
>I can load the library, get the function pointers etc., but when I call a
>function in the dll, the function succeeds, but the registers in the current
>functions corrupted.

Does your function pointer type have the correct calling convention?

Mattias

Signature

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

vikrantca - 05 Dec 2004 19:47 GMT
Yes, The function pointer is correct.
There are other functions (they take more parameters like char * etc.) that
work.

Different question -
When I declare double *x in managed c++ source file, is it a __nogc pointer
or a __gc pointer ?

While passing a char array to fortran dll do I need to pin the pointer ?

Thank you for your help.

vikrantca

"Mattias Sjögren" wrote:

> >I can load the library, get the function pointers etc., but when I call a
> >function in the dll, the function succeeds, but the registers in the current
[quoted text clipped - 3 lines]
>
> Mattias

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.