Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > DECLARE FUNCTION - DLL

Reply
Thread Tools

DECLARE FUNCTION - DLL

 
 
zzzxtreme@gmail.com
Guest
Posts: n/a
 
      01-04-2008
hi i built a very simple dll with delphi

library Printing;
uses
SysUtils, Classes, Dialogs;
{$R *.res}
function Hello: WideString; stdcall;
begin
ShowMessage('test');
result := 'blah';
end;
exports Hello;
begin end.



In VB.Net, i tired calling it. the ShowMessage executes, so that's a
start. I get this error afterwards, SEHException - "External component
has thrown an exception."

this is how i declared it

Declare Function Hello Lib "Printing.dll" () As String

It fails on returning a string. Does anyone know why?
 
Reply With Quote
 
 
 
 
Juan T. Llibre
Guest
Posts: n/a
 
      01-04-2008
Are you using Delphi 8 (Delphi.Net) ?

If not, you'll only get unmanaged assemblies,
which you'd need to create a wrapper for,
or use the Source Forge version to enable Delphi 5+ for .Net usage:

http://sourceforge.net/projects/delphinet

More info on Delphi 8.0 Basics:
http://www.delphibasics.co.uk/Net.html




Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaņol : http://asp.net.do/foros/
======================================
<> wrote in message news:35d8e10e-3bb6-4d36-a379-...
> hi i built a very simple dll with delphi
>
> library Printing;
> uses
> SysUtils, Classes, Dialogs;
> {$R *.res}
> function Hello: WideString; stdcall;
> begin
> ShowMessage('test');
> result := 'blah';
> end;
> exports Hello;
> begin end.


> In VB.Net, i tired calling it. the ShowMessage executes, so that's a
> start. I get this error afterwards, SEHException - "External component
> has thrown an exception."
>
> this is how i declared it
>
> Declare Function Hello Lib "Printing.dll" () As String
>
> It fails on returning a string. Does anyone know why?



 
Reply With Quote
 
 
 
 
zzzxtreme@gmail.com
Guest
Posts: n/a
 
      01-04-2008
thanks i found out the problem

delphi WideString is actually OLE-String.

I just changed to PAnsiChar


On Jan 5, 1:01*am, "Juan T. Llibre" <nomailrepl...@nowhere.com> wrote:
> Are you using Delphi 8 (Delphi.Net) ?
>
> If not, you'll only get unmanaged assemblies,
> which you'd need to create a wrapper for,
> or use the Source Forge version to enable Delphi 5+ for .Net usage:
>
> http://sourceforge.net/projects/delphinet
>
> More info on Delphi 8.0 Basics:http://www.delphibasics.co.uk/Net.html
>
> Juan T. Llibre, asp.net MVP
> asp.net faq :http://asp.net.do/faq/
> foros de asp.net, en espaņol :http://asp.net.do/foros/
> ======================================
>
> <zzzxtr...@gmail.com> wrote in messagenews:35d8e10e-3bb6-4d36-a379-...
> > hi i built a very simple dll with delphi

>
> > library Printing;
> > uses
> > *SysUtils, *Classes, Dialogs;
> > {$R *.res}
> > function Hello: WideString; stdcall;
> > begin
> > * ShowMessage('test');
> > *result := 'blah';
> > end;
> > exports Hello;
> > begin end.
> > In VB.Net, i tired calling it. the ShowMessage executes, so that's a
> > start. I get this error afterwards, SEHException - "External component
> > has thrown an exception."

>
> > this is how i declared it

>
> > Declare Function Hello Lib "Printing.dll" () As String

>
> > It fails on returning a string. Does anyone know why?


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Declare a Friend function which is a template member function of adifferent class getrakesh@gmail.com C++ 2 02-26-2008 11:32 AM
forward declare member function so that it can be friend function yancheng.cheok@gmail.com C++ 1 11-09-2006 11:30 AM
how to declare pseudo-matrix function argument that is not modified by function? classicist C Programming 3 10-05-2005 02:45 AM
How to determine if a DLL is a COM DLL or .NET DLL Anushi ASP .Net 5 10-28-2004 01:59 PM
msvcrt.dll, msvcirt.dll, msvcrt20.dll and msvcrt40.dll, explanation please! Snoopy NZ Computing 16 08-25-2003 12:34 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57