🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.csharpbuilder.language.csharp
Article #610

Re: How catch an exception from a DLL?

#610
From: RB
Date: Mon, 05 Jul 2004 14:43
35 lines
2064 bytes
Thank you.

I'll see if it works.

Regards RB


"Marc Rohloff [TeamB]" <"on request"> skrev i en meddelelse
news:193bdpxktzyux.dlg@marcrohloff.40tude.net...
> On Fri, 2 Jul 2004 02:15:01 +0200, RB wrote:
>
> > I have a DLL written in Delphi. Here I raises an exception.
> > In the calling method I catches the exception, and then would like to
handle
> > the exception.
> > The caught exception turns out to always be a SEHException, with
> > apparently no information about the actual raised exception.
> > What can I do?
>
> Redefine the method to be safecall instead of stdcall.
>
> Modify the DllImport attribute in c# with PrserveSig=false.
>
> Wrap your Delphi function with an exception handler. When you get an
> exception setup the correct IErrorInfo that you want and reraise the
> exception.
>
> There is a fair bitof information about setting up IErrorInfo on the
> web. You can also look at the way Delphi does it. Start at the
> SafeCallException method, poke around in comobject.pas.  IIRC you may
> be able to use some of the code as is.
>
> -- 
> Marc Rohloff [TeamB]
> marc rohloff at myrealbox dot com
Technical Details
Message-ID: <40e9691a@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.frii.net!newsfeed.frii.net!news.compaq.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <40e4a93f$1@newsgroups.borland.com> <193bdpxktzyux.dlg@marcrohloff.40tude.net>

Show Full Headers
Complete Article Headers
X-Google-Thread: 1efe35,af37c7da03bedca2
X-Google-Attributes: gid1efe35,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "RB" <rb@newmail.dk>
Newsgroups: borland.public.csharpbuilder.language.csharp
References: <40e4a93f$1@newsgroups.borland.com> <193bdpxktzyux.dlg@marcrohloff.40tude.net>
Subject: Re: How catch an exception from a DLL?
Date: Mon, 5 Jul 2004 16:43:43 +0200
Lines: 37
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 80.166.178.207
Message-ID: <40e9691a@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1089038618 80.166.178.207 (5 Jul 2004 07:43:38 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.frii.net!newsfeed.frii.net!news.compaq.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail