forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Debugging a DLL missing the symbols
Goto page Previous  1, 2
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
Werner



Joined: 23 Oct 2009
Posts: 12

PostPosted: Tue Dec 08, 2009 9:12 am    Post subject: Reply with quote

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
View user's profile Send private message
Werner



Joined: 23 Oct 2009
Posts: 12

PostPosted: Wed Dec 09, 2009 11:22 am    Post subject: Reply with quote

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
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7927
Location: Salford, UK

PostPosted: Wed Dec 09, 2009 1:48 pm    Post subject: Reply with quote

Did you ever get to reading the help file on this subject?
Back to top
View user's profile Send private message AIM Address
Werner



Joined: 23 Oct 2009
Posts: 12

PostPosted: Thu Dec 10, 2009 11:16 am    Post subject: Reply with quote

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 Embarassed 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
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7927
Location: Salford, UK

PostPosted: Thu Dec 10, 2009 11:35 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
Werner



Joined: 23 Oct 2009
Posts: 12

PostPosted: Thu Dec 10, 2009 12:11 pm    Post subject: Reply with quote

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 Confused

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
View user's profile Send private message
Werner



Joined: 23 Oct 2009
Posts: 12

PostPosted: Thu Dec 10, 2009 12:19 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General All times are GMT + 1 Hour
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group