View previous topic :: View next topic |
Author |
Message |
Werner
Joined: 23 Oct 2009 Posts: 12
|
Posted: Tue Dec 08, 2009 9:12 am Post subject: |
|
|
Next and maybe the last try before switching back to VisualStudio
The ThirdParty Tool has a frame C++ programm for the user DLL.
An example of a subroutine for VisualStudio C++ is here
Code: |
#define DLL __declspec(dllexport)
DLL DWORD GetDllVersion(void)
{
return (DLL_INTERFACE_VERSION_HIGH | 1);
}
|
So, SCC don't unterstand __declspec ..
Does anyone knows how I have to change this code, if I want to compile it with SCC, so that all is well with the calling conventions etc?
If I change it to :
Code: |
#define DLL
DLL DWORD WINAPI GetDllVersion(void)
{
return (DLL_INTERFACE_VERSION_HIGH | 1);
}
|
than I can translate and a part of the programm is running, but I have the problem with the stack handling
Thanks
Werner |
|
Back to top |
|
|
Werner
Joined: 23 Oct 2009 Posts: 12
|
Posted: Wed Dec 09, 2009 11:22 am Post subject: |
|
|
OK, I climbed over the first little hill.
the code in the right way must be:
Code: |
#define DLL extern "C"
DLL DWORD GetDllVersion(void)
{
return (DLL_INTERFACE_VERSION_HIGH | 1);
}
|
It could be so easy. The problem was the WINAPI. Because WINAPI is STDCALL for windows and CDECL for WIndows CE.
So I throw WINAPI away. But now the Tool which calls my DLL is C++ and here the "name mangling" is done. That means, as I unterstand, that all the parameters will be checked. So that my DLL runs well with the Tool I have to write EXTERN "C" for the subroutines and name mangling is switched off for them.
And now all runs well.
So, no I am back at my first problem to debugg this DLL. I keep on trying. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7930 Location: Salford, UK
|
Posted: Wed Dec 09, 2009 1:48 pm Post subject: |
|
|
Did you ever get to reading the help file on this subject? |
|
Back to top |
|
|
Werner
Joined: 23 Oct 2009 Posts: 12
|
Posted: Thu Dec 10, 2009 11:16 am Post subject: |
|
|
Hello Paul,
yes I have read the help file. But I have also to search a lot in internet to find this solution. In the help file I found only that FNT95 ( and that is Fortran) don't use STDCAL. But my problem is in C++ with the SCC compiler. In the help of SCC,I found nothing about the used calling conventions there. I dont know what SCC use instead of STDCAL.
But I get enlightened when I read "List of calling Conventions" and "Name mangling in C++" from David Bolton at httpt://cplus.about.com.
Sorry if I get on your nerves, but normaly I don't have to handle with these things. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7930 Location: Salford, UK
|
Posted: Thu Dec 10, 2009 11:35 am Post subject: |
|
|
FTN95 does not use STDCALL by default but you can use the keyword F_STDCALL. There is also a load of other stuff about STDCALL and in particular how to call C++ functions that use STDCALL.
You can also import from a Fortran library when that library uses STDCALL by using the command line switch /import_lib. |
|
Back to top |
|
|
Werner
Joined: 23 Oct 2009 Posts: 12
|
Posted: Thu Dec 10, 2009 12:11 pm Post subject: |
|
|
Hello Robert,
I don't want to nerve, but I am not able to debug.
I try as follow:
I start sdbg from a BAT-File
Code: |
SET SOURCEPATH = c:\Programme\iba\ibaLogic v4\Server; c:\Programme\iba\ibaLogic v4\Server\dll; D:\silverfrost; D:\silverfrost\Debug; D:\silverfrost\Debug\Win32;
SDBG /RUNTO "c:\Programme\iba\ibaLogic v4\Server\dll\ibaLogicRahmenDll.dll" 640
|
SDBG ask me for the programm to debug:
Quote: |
"C:\Programme\iba\ibaLogic v4\Server\ibaLogicLZS.exe"
|
That starts that programm and after a while there is a message window (waiting for breakpoint)
I must than start anorther Client-Applikation to handle with these ibaLogicLZS and "start" an applikation with my DLL.
Than the SDBG stops somewhere and a message came "Set Breakpoint" and "This is not a line that can be breakpointed".
How found the SDBG the right source file? Is the line number, the line number in my sourcefile? Question and Questions
Quote: |
Can you send us the program so we can try and see what is going on? We don't need the source files at least not to find out why sdbg is stopping in ntdll. |
How can I send you the source code, that we can discuss it? Is it possible to upload it somewehre? |
|
Back to top |
|
|
Werner
Joined: 23 Oct 2009 Posts: 12
|
Posted: Thu Dec 10, 2009 12:19 pm Post subject: |
|
|
Hello Paul,
I unterstand your descritption of F_STDCAL and so on. But this is if I want to call C++ from FTN95.
My first problem has been that a C++ Programm ( a Tool that I use) written with VisualStudiol, calls my DLL written in C++ with PLATO and SCC without any fortran code in the moment.
Maybe my english is not well enough that we unterstand us in a right way.
OK, but this part is running. Also the next step, that I call now from my DLL (written in C++, compiled with SCC/PLATO) another DLL (written in Fortran FTN95, compiled with PLATO) is running well.
Still exists the problem with debuging, as descriped in my last posting. |
|
Back to top |
|
|
|