When is pinning required?

A

AMercer

I have a legacy C dll that I call from VB .net, and I'm unsure about when
pinning is necessary. The called functions in the dll run on a worker thread.

The case I am worried about is an array of doubles. I have an array 'dim
x(10) as double'. I call a C function with x(0) passed byref, and the C
function expects double*. This works fine, but I don't know if array x needs
to be pinned. In other words, I may have a bug that will eventually bite me
when GC and my call run concurrently. Does anyone know whether pinning is
necessary or not in this setting?
 
A

Armin Zingler

Am 27.05.2010 22:24, schrieb AMercer:
I have a legacy C dll that I call from VB .net, and I'm unsure about when
pinning is necessary. The called functions in the dll run on a worker thread.

The case I am worried about is an array of doubles. I have an array 'dim
x(10) as double'. I call a C function with x(0) passed byref, and the C
function expects double*. This works fine, but I don't know if array x needs
to be pinned. In other words, I may have a bug that will eventually bite me
when GC and my call run concurrently. Does anyone know whether pinning is
necessary or not in this setting?

IIRC, if you pass an array item ByRef to a native function, the whole array
is pinned automatically. I'm still looking for the source of this information
(I remember I once read it) but I'm pretty sure it's true.
 
H

Herfried K. Wagner [MVP]

Armin --

Am 27.05.2010 23:05, schrieb Armin Zingler:
IIRC, if you pass an array item ByRef to a native function, the whole array
is pinned automatically. I'm still looking for the source of this information
(I remember I once read it) but I'm pretty sure it's true.

IIRC this is at least the case if the function is declared using VB's
'Declare' statement.
 
A

Armin Zingler

Am 28.05.2010 09:14, schrieb Cor Ligthert[MVP]:
Hi Armin,

When do we see you in the English VB general forum.
Never.

http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/threads?page=1

The first time, I only wanted to change my "settings" there, I was asked
to agree to <whatever>. I don't agree to Microsoft's private yadda yadda.

Discussions should be free. The usenet is free.

Herfried has already done that, I hope you don't left me alone when we see
to much echo's there in future?

:)

I'm disappointed that you support such business practices. I suggest
to boycott that, too. Let's have them search for new MVPs.

(We (from "de") are about to establish
appropriate groups in the de.* hierarchy and asking
news server admins to keep the microsoft.public
hierarchy at least until the new groups exist.)

So, we will have to say "good bye" on May, 31st.
 
A

AMercer

IIRC, if you pass an array item ByRef to a native function, the whole array
IIRC this is at least the case if the function is declared using VB's
'Declare' statement.

I am using 'Declare', and the sub parameter is declared like 'byref x as
double'. In my vb code, I have 'dim x(10) as double', and I call the sub
passing x(0). So, it sounds like I am safe. I have also searched high and
low for info on this subject, and I couldn't find anything definite.
 
C

Cor Ligthert[MVP]

Hello Armin,

In my idea the newsgroups don't close at exactly the first of June, I
understood that they start with closing newsgroups after that date, but not
all in one time in my idea.

However, don't be of those who also signed the petition some years ago, it
is easier to join and to try to pull a little bit the steering wheel in a
better direction.

The closing of the newsgroups we could've expect, there was not created
almost any newsgroup for years.

There is fought behind the lines to make that process slower, but someday we
could expect it would be done. It is not like for us in Europe that for
everything the words credit crisis are used. But the policy seems the same.

Are you creating a new Germany for that, I certainly think that trying to
create a new Holland will make sense?

:)

Cor
 
E

eBob.com

Gee Armin, I am so grateful for all the help you've given me here over the
past several years. It will be a major loss to those using this newsgroup
if you do not participate in the MS web-based forums. But I do understand
your position.

I know very little about newsgroups. Is it possible to keep the microsoft.*
groups without Microsoft's blessing? Or replicate the microsoft.* hierarchy
under some other high level qualifier like alt.* or comp.*?

In any event, as things stand, I don't see that I have much choice but to
move to the new MS web-based forums. So this may be my last chance to say
thank you so much for all the help you've given me here! Really, "thank
you" isn't sufficient, but I don't know a better way to say it.

Bob
 
A

Armin Zingler

Am 28.05.2010 14:43, schrieb Cor Ligthert[MVP]:
Hello Armin,

In my idea the newsgroups don't close at exactly the first of June, I
understood that they start with closing newsgroups after that date, but not
all in one time in my idea.

Yes. I'm not sure, but I'm prepared. :)
However, don't be of those who also signed the petition some years ago, it
is easier to join and to try to pull a little bit the steering wheel in a
better direction.

Petition? I missed it.

(the only petition I subscribed was against the planned prohibition of
"action computer games" here in Germany)
The closing of the newsgroups we could've expect, there was not created
almost any newsgroup for years.

ah, that was the petition(?)
There is fought behind the lines to make that process slower, but someday we
could expect it would be done. It is not like for us in Europe that for
everything the words credit crisis are used. But the policy seems the same.

Sorry, I don't understand. This was planned for longer and there was a struggle?
Are you creating a new Germany for that, I certainly think that trying to
create a new Holland will make sense?

:)

Only a small nice place inside the de.* hierarchy. You're welcome there, too.
You can even bring your caravan along. ;-)
 
A

Armin Zingler

Am 28.05.2010 18:27, schrieb eBob.com:
Gee Armin, I am so grateful for all the help you've given me here over the
past several years. It will be a major loss to those using this newsgroup
if you do not participate in the MS web-based forums. But I do understand
your position.

Thanks a lot! Always a pleasure.
I know very little about newsgroups. Is it possible to keep the microsoft.*
groups without Microsoft's blessing? Or replicate the microsoft.* hierarchy
under some other high level qualifier like alt.* or comp.*?

Usually, if a group is removed, it will be removed from all servers. (I don't
know the details about this process.) In a German group, I've heart of
some efforts made to convince major news server providers to ignore the
groups removal request, at least for the next weeks to gain time to
establish new groups. I support this, but I think it won't be very successful
(for different reasons; not everyone can access every server, etc)
In any event, as things stand, I don't see that I have much choice but to
move to the new MS web-based forums. So this may be my last chance to say
thank you so much for all the help you've given me here! Really, "thank
you" isn't sufficient, but I don't know a better way to say it.

It _is_ sufficient. :) ....Wait, you could offer me a job! ;-) I don't
have one currently. Isn't that sad? Well, admittedly I haven't been looking
for one lately. But that's another story....

Anyway, "see you"!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top