[Solved] Static Variable in MyServiceImpl

Java, C++, C#, Delphi... - Using the UNO bridges
Post Reply
saleem145
Posts: 130
Joined: Mon Jul 02, 2012 4:47 pm

[Solved] Static Variable in MyServiceImpl

Post by saleem145 »

Hello,

I would like to declare a variable as static in MyServiceImpl so it is shared across class instances. I tried

static Dataset *idx;

The class does compile without the static keyword but fails to compile with static keywork. Any ideas??

Thanks,

Saleem
Last edited by Hagar Delest on Tue Jul 10, 2012 11:21 pm, edited 1 time in total.
Reason: tagged [Solved].
OpenOffice 3.4.0
Mac OS X 10.5.8
saleem145
Posts: 130
Joined: Mon Jul 02, 2012 4:47 pm

Re: Static Variable in MyServiceImpl

Post by saleem145 »

Actually sorry for this post. I believe I have figured out the issue.
OpenOffice 3.4.0
Mac OS X 10.5.8
User avatar
Hagar Delest
Moderator
Posts: 33629
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: Static Variable in MyServiceImpl

Post by Hagar Delest »

Can you post your findings? It may help other users.
LibreOffice 25.2 on Linux Mint Debian Edition (LMDE 7 Gigi) and 25.2 portable on Windows 11.
saleem145
Posts: 130
Joined: Mon Jul 02, 2012 4:47 pm

Re: Static Variable in MyServiceImpl

Post by saleem145 »

Sure. It was just a C++ issue. I declared the type to be static and then was assigning a value of NULL to it in the class constructor. This is not permitted in C++ since the variable is shared accross all objects.
OpenOffice 3.4.0
Mac OS X 10.5.8
Post Reply