AW: [omniORB] DLLified echo example

Gavin Uttley guttley at iess.co.uk
Mon May 23 13:40:40 BST 2005


Hi,

OK, i tried this although i still get the same exception when being 
called via a dll from a delphi app.
I did a quick test running the same class in a C++ exe and it worked 
fine, perhaps this is something
todo with it beign called via a dll?


gav,



fischer.c at atlas.de wrote:

>Hi,
>
>you should write your function the following way:
>
>/*-----------------------------------------------------------------------*/
>char* Hello(CORBA::Object_ptr obj, CORBA::String_var src)
>{
>    // use Echo_var instead of Echo_ptr for proper reference counting
>    Echo_var e = Echo::_narrow(obj); 
>
>    if( CORBA::is_nil(e) ) {
>        errLog << "hello: The object reference is nil!\n" << endl;
>
>        // return dynamically allocated memory here
>        return CORBA::string_dup("");
>    }
>
>    // do not release memory on return
>    return e->echoString(src);
>
>    // or this way:
>    /*
>    CORBA::String_var dest = e->echoString(src);
>    return dest._retn();
>    */
>}
>    
>/*-----------------------------------------------------------------------*/
>
>You should always have in mind one of the basic CORBA IDL to C++ mapping rules:
>
>Functions with variable-size return values like strings (or structures containing string or sequences or something similar) always return dynamically allocated memory and the caller is responsable for releasing the returned memory (usually by using a _var type).
>
>
>
>  
>


This message has been sent from Initial Electronic Security Systems Ltd.

Initial Electronic Security Systems
Shadsworth Road
Blackburn
BB1 2PR
United Kingdom
Tel +44(0) 1254 688688

This e-mail message and any attachments are confidential
and are intended for the use of the addressee only. If you 
are not the addressee you should not copy or use them for 
any purpose, nor disclose their contents to anyone else. 
If you believe you have received this e-mail by mistake please 
notify us immediately by telephoning +44 (0) 1254 688688.
_____________________________________________________________________
This message has been checked for all known viruses by the MessageLabs Virus Scanning Service.



More information about the omniORB-list mailing list