Hi,

Well, it works if I don't use the ICUEnumeration class. The first call
returns an NBExternalAddress instance. If I pass this instance to the
second call than it works fine. The native call looks like this:

self nbCall: #( char* uenum_next_48(void* aHandle, nil, ICUErrorCodeNB*
anErrorCode ) )

My idea was to use a subclass of NBExternalHandle where I can put all the
functions related to this handle. But it stops working when I copy the
value from the ExternalAddress to my handle subclass ICUEnumerationNB and
use one of these calls:

self nbCall: #( char* uenum_next_48(ICUEnumerationNB* aHandle, nil,
ICUErrorCodeNB* anErrorCode ) )

or

self nbCall: #( char* uenum_next_48(ICUEnumerationNB aHandle, nil,
ICUErrorCodeNB* anErrorCode ) )

Jan.

On Tue, Feb 14, 2012 at 10:10 PM, Igor Stasenko <[email protected]> wrote:

> On 14 February 2012 22:59, Jan van de Sandt <[email protected]> wrote:
> > I started with a new image and loaded ConfigurationOfNativeBoost. But
> it's
> > still not working.
> >
> > First I do a call to get a handle:
> >
> > "UEnumeration* ucal_openTimeZones(UErrorCode * ec)"
> >
> > self nbCall: #( void* ucal_openTimeZones_48( ICUErrorCodeNB* anErrorCode
> ) )
> > module: 'libicui18n.dylib'
> >
> > This call succeeds. I store the result in a subclass of NBExternalHandle
> > using the #value: class method.
> >
> > In the second call I want to use the handle to retrieve the next element:
> >
> > self nbCall: #( char* uenum_next_48(ICUEnumerationNB* aHandle, int* nil,
> > ICUErrorCodeNB* anErrorCode ) ) module: 'libicuuc.dylib'
> >
> > But this call still causes the image to disappear. I think the nil and
> > errorCode arguments are all right. Is there something wrong with the
> first
> > argument?
>
> I cannot say precisely, because i don't see a code.. so lets see..
>
>  UEnumeration* U_EXPORT2 ucal_openTimeZones     (       UErrorCode *    ec
> )
>
> returns a pointer.
> And you storing the pointer value to instance of ICUEnumerationNB
>
>
> Now i guess that next function should take that  pointer value:
>
> char* uenum_next_48(ICUEnumerationNB aHandle, int* nil,
> ICUErrorCodeNB* anErrorCode  )
>
> but not a pointer to pointer value, like you wrote:
>
> char* uenum_next_48(ICUEnumerationNB* aHandle, int* nil,
> ICUErrorCodeNB* anErrorCode  )
>
>
> >
> > Jan.
> >
> >
> >
> >
> >
> > On Tue, Feb 14, 2012 at 11:34 AM, Igor Stasenko <[email protected]>
> wrote:
> >>
> >> On 13 February 2012 22:40, Jan van de Sandt <[email protected]> wrote:
> >> > Hello list,
> >> >
> >> > I want to call the following C function using NativeBoost:
> >> >
> >> > const char* uenum_next(UEnumeration * en, int32_t * resultLength,
> >> > UErrorCode
> >> > * status)
> >> >
> >> > According to the (icu4c) documentation you can pass NULL for the
> >> > resultLenth
> >> > argument [1]. But when I try:
> >> >
> >> > self nbCall: #( char* uenum_next_48( self, nil, ICUErrorCodeNB*
> >> > anErrorCode
> >> > ) ) module: 'libicuuc.dylib'
> >>
> >> should be no problem.
> >> you can try also to just pass zero, if it make any difference
> >>
> >>  self nbCall: #( char* uenum_next_48( self, 0 , ICUErrorCodeNB*
> >> anErrorCode ) ) module: 'libicuuc.dylib'
> >>
> >> (in fact code generator should produce same code, since nil
> >> substituted by 0 at the end).
> >>
> >> Maybe the problem is not there, but in other arguments you passing.
> >>
> >> And, i recommend you to use ConfigurationOfNativeBoost from
> >> NBInstaller, but not latest packages directly, since Javier put a lot
> >> of changes lately and some parts might not work properly.
> >>
> >>
> >> >
> >> > My image craches. Does anyone know what I'm doing wrong?
> >> >
> >> > Jan.
> >> >
> >> >
> >> > [1]
> http://icu-project.org/apiref/icu4c/uenum_8h.html#a99298eabaa3874cdfd9793b207848f68
> >>
> >>
> >>
> >> --
> >> Best regards,
> >> Igor Stasenko.
> >>
> >
>
>
>
> --
> Best regards,
> Igor Stasenko.
>
>

Reply via email to