Assuming this is an ObjC module, and assuming the warning did NOT come from
GSInitializeProcess():
Below GSInitializeProcess() add [NSAutoreleasePool alloc].

If this is not an ObjC module, make it one or add a new .m file, and call
the method from there. :)

The contraption will be leaky unless you occasionally drain it, but this is
still a good first step.

On Fri, Mar 3, 2017 at 12:03 PM, Riccardo Mottola <
[email protected]> wrote:

> Hi Richard
>
>
> On 03/03/17 10:38, Richard Frith-Macdonald wrote:
>
>> For fake main to work, you have to include a GNUstep header file (eg
>> Foundation/NSObject.h) in the source file where main() is used.
>>
>> So typically that won't work if you are writring library code which is to
>> be called from some application that's not GNUstep aware (ie where the
>> source code you have never calls main()).
>>
>> In that situation you should be able to call GSInitializeProcess() to
>> perform the setup before doing anything else.
>>
>
> thank you for the information. Ineed, I cannot include directly the header
> from main, however I added a hook function which calls it as first function
> in main.c.
>
> #ifdef NS_IMPL_GNUSTEP
> extern void gs_initialize_process (int argc, char** argv, char** envp)
> {
>   GSInitializeProcess(argc, argv, envp);
> }
> #endif
>
>
> I get now this:
> 2017-03-03 12:57:16.148 bootstrap-emacs[26596:145924880] autorelease
> called without pool for object (0x8f7c650) of class NSMethodSignature in
> thread <NSThread:
> 0x8b2a310>{name = (null), num = 145924880}
> 2017-03-03 12:57:16.162 bootstrap-emacs[26596:145924880] autorelease
> called without pool for object (0x911efd0) of class NSMutableDataMalloc in
> thread <NSThread: 0x8b2a310>{name = (null), num = 145924880}
>
> Is other initialization missing? Since the code works when fake main is
> not needed and there are no autorelease pool issues, my guess is yes, but
> what?
>
> Riccardo
>
>
> _______________________________________________
> Discuss-gnustep mailing list
> [email protected]
> https://lists.gnu.org/mailman/listinfo/discuss-gnustep
>
_______________________________________________
Discuss-gnustep mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep

Reply via email to