Questions tagged [shared]

In VB.NET, the Shared keyword is roughly equivalent to the static keyword used by many other languages.

In , the Shared keyword is roughly equivalent to the static keyword used by and many other languages.

For example, the following code snippet in VB.NET:

Public Class Foo
    Public Shared Bar As String
End Class

Is equivalent to the C#:

public class Foo
{
    public static string Bar;
}

Further Reading

OpenMP

In OpenMP, it corresponds to the status of a variable. In a parallel section, a SHARED variable will be shared by all the running threads, meaning they will all access this variable and could modify it simultaneously. It is the default status of every variable in a parallel section, apart from the iteration counters.

1404 questions
18
votes
3 answers

Public Static variable in excel vba

Is it possible to have a static variable declared in one procedure, and use this variable in several different procedures using Excel VBA? i.e. Public myvar as integer Sub SetVar() static myvar as integer myvar=999 end sub sub Usevar() …
Zeus
  • 1,496
  • 2
  • 24
  • 53
18
votes
3 answers

C++ raw pointer and std::shared_ptr

I am working with std::shared_ptr and during my software development I met a couple of cases that let me doubt about memory management. I had a third party library that gave me always raw pointers from functions and in my code I was transforming…
ISTB
  • 1,799
  • 3
  • 22
  • 31
17
votes
2 answers

"Access of shared member, constant member, enum member or nested type through an instance"

I wonder why Visual Studio is raising this warning: Access of shared member, constant member, enum member or nested type through an instance My code: Dim a As ApplicationDeployment =…
Petr Kováč
  • 365
  • 1
  • 2
  • 10
16
votes
3 answers

Constant Shared array in vb.net

Is there a way to create a constant shared array? The ovbious way : Shared Const GX() As String = {"GS", "GP"} Is not working, it says you can't use shared and const together. If you use only const it says you can't declare a contant array in a…
user2703636
16
votes
5 answers

C - shared memory - dynamic array inside shared struct

i'm trying to share a struct like this example: typedef struct { int* a; int b; int c; } ex; between processes, the problem is that when I initialize 'a' with a malloc, it becomes private to the heap of the process that do this(or at…
ChiP
  • 313
  • 1
  • 2
  • 9
15
votes
3 answers

Unix: sharing already-mapped memory between processes

I have a pre-built userspace library that has an API along the lines of void getBuffer (void **ppBuf, unsigned long *pSize); void bufferFilled (void *pBuf, unsigned long size); The idea being that my code requests a buffer from the lib, fills it…
gimmeamilk
  • 2,016
  • 5
  • 24
  • 36
15
votes
1 answer

Android Intents: Start activity using class name from another app that has the same sharedUserId

All my apps have the same sharedUserId. I would like to start a class of another app using the class of my current app. I want to use intent extras but I do not want to use intent URLs. I also would prefer not to have to change the AndroidManifest…
700 Software
  • 85,281
  • 83
  • 234
  • 341
15
votes
5 answers

Vista and ProgramData

What is the right place to store program data files which are the same for every user but have to be writeable for the program? What would be the equivalent location on MS Windows XP? I have read that C:\ProgramData is not writeable after…
frast
  • 2,700
  • 1
  • 25
  • 34
14
votes
1 answer

gcc -l option and .la library files

Could you please explain, how linking with -l option against .la files works? As far as my experience reaches - i have only linked against static library (.a) files. Now i took a look at some Qt generated Makefiles and cant figure out, how linker…
0xDEAD BEEF
  • 2,074
  • 7
  • 31
  • 46
13
votes
4 answers

how to Shared element transition from a fragment to an activity

I have three fragments inside a ViewPager in an activity, I want to achieve shared element transition from one of the fragments to another activity. The transition is from a recycler view which is inside a fragment which is inside a viewpager which…
Adarsh Jain
  • 165
  • 1
  • 2
  • 12
13
votes
1 answer

Can't get Flask running using Passenger WSGI on Dreamhost shared hosting

I'm trying to get a Flask "hello world" application working on a Dreamhost shared server, following the instructions on their wiki, but I'm not having any luck. My Flask application is the "hello world" one from the Flask quickstart guide: from…
Dave Hollingworth
  • 3,670
  • 6
  • 29
  • 43
13
votes
2 answers

Recommendations on sharing validation rules between Javascript and PHP?

We're in the process of writing a new form which our front-end coder has included lots and lots of JavaScript validation (technically, jQuery Tools validation). I'm writing the PHP server-side part of the process, and of course, my own code will be…
PhilGA
  • 303
  • 2
  • 8
12
votes
3 answers

Why does the linker modify a --defsym "absolute address"

Goal: a shared library to use a function from an executable (which does not export symbols). Means: gcc -Wl,--defsym,function=0x432238 The man page states that: "--defsym symbol=expression" Create a global symbol in the output file, containing the…
Gil
  • 3,279
  • 1
  • 15
  • 25
12
votes
2 answers

How to create a shared library in Android

I have a library, say LIB, which exposes the quite a few APIs and classes for use by application developers. If there are more than one applications that use LIB on the phone, I want only one instance of LIB to be created and running. It is somewhat…
Robin
  • 497
  • 5
  • 19
12
votes
1 answer

What's the best way to initialize shared members in a class in VB.NET?

I was looking on the Internet to see if there were any good examples on how to initialize shared members within a class while still initializing instance variables. I did find an expression that might fit to the answer: Shared Sub New() 'Declare…
Chad Harrison
  • 2,836
  • 4
  • 33
  • 50
1 2
3
93 94