- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You should show us the relevant parts of Delphi caller also, especially declaration of DllRoutine1 and the calling code. The thing that structs my mind first is that DllRoutine should be declared in Delphi as stdcall (which is, to my recent surprise, not Delphi default -- it's something like register call) and dllimport.
You may debug your DLL from CVF to inspect values and LOCs of what's actually passed in (just set in Project/Settings/Debug/Executable for Debug Session the path to Delphi .exe). Without seeing your actual code, it's tough to say what went wrong.
Jugoslav
You may debug your DLL from CVF to inspect values and LOCs of what's actually passed in (just set in Project/Settings/Debug/Executable for Debug Session the path to Delphi .exe). Without seeing your actual code, it's tough to say what went wrong.
Jugoslav
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, that calling mechanism looks OK. My knowledge on Delphi is shallow;
however, the point is that you have to pass four addresses into the routine somehow. I think that alternate calling procedure would be:
Maybe declaration that arguments are array of whatever should also work, provided that call-array-by-reference is Delphi's default. In that case, only Arrays should appear in actual arg-list (without @).
As for debugging, you should do the following:
- In Visual Studio, in Project/Settings/Debug/Executable for Debug Session box, enter the name of Delphi executable,
- Make sure there's a copy of your Dll in exe's directory or in PATH. AFAIK, that copy serves only to make the exe happy; it's not actually being called, but the one you debug, i.e. the one in your .../DllProject/Debug directory (however, I'm not 100% sure about the latest statement).
- Set breakpoints in your Dll as desired.
- Debug/Go (F5). You'll get the warning that the .exe doesn't contain debug info -- ignore it. The exe starts normally -- do the necessary steps
in it to invoke Dll and voila -- the debugger stops at the breakpoint.
HTH
Jugoslav
however, the point is that you have to pass four addresses into the routine somehow. I think that alternate calling procedure would be:
procedure DLLRoutine1(var Array1, Array2, Array3, Array4: pointer); stdcall; external 'MyDll.dll'; ... DLLRoutine1(@Array1, @Array2, @Array3, @Array4);
Maybe declaration that arguments are array of whatever should also work, provided that call-array-by-reference is Delphi's default. In that case, only Arrays should appear in actual arg-list (without @).
As for debugging, you should do the following:
- In Visual Studio, in Project/Settings/Debug/Executable for Debug Session box, enter the name of Delphi executable,
- Make sure there's a copy of your Dll in exe's directory or in PATH. AFAIK, that copy serves only to make the exe happy; it's not actually being called, but the one you debug, i.e. the one in your .../DllProject/Debug directory (however, I'm not 100% sure about the latest statement).
- Set breakpoints in your Dll as desired.
- Debug/Go (F5). You'll get the warning that the .exe doesn't contain debug info -- ignore it. The exe starts normally -- do the necessary steps
in it to invoke Dll and voila -- the debugger stops at the breakpoint.
HTH
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
See at http://www.nag.co.uk/numeric/BorlandDelphi.asp to know how to call fortran dlls from Delphi and how to pass the parameters like integer, string, function, procedure, multi-dimensional arrays
Jean-Luc
Jean-Luc

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page