The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 How to debug an external DLL?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

dlw21

USA
18 Posts

Posted - 01/30/2003 :  2:18:15 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello,

I am looking for tips & tricks for debugging an externally-loaded DLL. I have a DLL (created with VC++ v6.0) loaded with OriginC (via #pragma dll(path\to\dll\file)), and my OriginC code compiles and links with no errors. However, when I run the OriginC code, it bombs out with the cryptic message "External call execution error".

I am wondering how I might obtain more specific info on what has happened. My usual (brain-dead) method involves opening a file within the DLL function and writing strings to it at various points in its execution, but for my current problem it doesn't seem to be getting to the point where it can even open the file.

So, I am looking for any advice on:
- how to get more informative messages from Origin, if possible
- how to attach the VC++ debugger to this DLL after it's been loaded into Origin
- any other tricks that have worked for people in the past

I am using OriginPro 7SR3 on WinXP.

Thanks,
Dave

cpyang

USA
1406 Posts

Posted - 01/30/2003 :  2:36:24 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You should always be able to debug your DLL by setting Origin70.exe as the debugging application from your developer studio project.

Maybe you should check the calling convention? Have you tried with

__stdcall

or without?

CP



Go to Top of Page

eparent

118 Posts

Posted - 01/30/2003 :  2:45:46 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
To debug a DLL:
- Build your DLL with debug information.
- Set a breakpoint in the DLL function you want to debug.
- In VC Project Settings, on the Debug tab, set the Executable to the Origin exe file.
- Start Debug.

Origin will run and VC will become active when Origin loads your DLL and calls the function you put a breakpoint in. You are now able to step through the code for your DLL's function.

If Origin fails to load your DLL or fails to call your function then you will not be able to debug your DLL. This could indicate a problem with the Origin C header file you made for your DLL or how the function is being exported.


Go to Top of Page

dlw21

USA
18 Posts

Posted - 01/30/2003 :  2:46:32 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
CP,

Thanks for a prompt response. Since posting this note I realized that one of my LabTalk variables is not getting initialized properly. Unfortunately the OGS code looks correct (I posted a thread on the LabTalk forum just now regarding this problem -- see that post for a description) and certainly has not changed since having upgraded from SR2 (it worked in that release).

So my guess is that since an invalid value (NANUM) is being passed to the external DLL, the call is failing (which is reasonable to expect!).

Like I said, this problem appears to have actually started with an assignment statement in a LabTalk OGS file that doesn't produce the expected results:

maxE = Tab.Sys.Egap.v1;

produces NANUM even though the right-hand variable has the correct value (according to the OriginC debugger). Again, this line worked with no problem before SR3.

Perhaps this a bug?

Thanks,
Dave


Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000