It is currently Thu Sep 09, 2010 8:38 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: [Done] Static array in a DLL
PostPosted: Wed Jun 09, 2010 4:17 pm 
Offline
Addict
Addict
User avatar

Joined: Sun Nov 05, 2006 11:42 pm
Posts: 1451
Location: Lyon - France
Hello at all

You say to you, KCC have always a problem, but i use this time the last version 4.50 RC2
But i have a problem with the DLL, and i want just know, if it's normal :mrgreen:

When i compile in 4.30 this code
That's works good, if i dim LOCAL, STATIC or in GLOBAL the "ArrayString"

Exe
Code:
If OpenLibrary(0, "c:\Try.dll")
*Pointeur = CallFunction(0, "Try")
Debug *Pointeur
EndIf


DLL
Code:
ProcedureDLL Try()
Static Dim ArrayString.s(10)
ArrayString(0) = "Hello"
ProcedureReturn @ArrayString()
EndProcedure


But with the v4.50 RC2, that don't works in STATIC dim
I have an error memory :shock:

Just works with "Dim ArrayString.s(10)" or "Global Dim ArrayString.s(10)"
Kcc is very sad to give works at the TEAM :(

Perhaps i don't must declare it in STATIC ??? :roll:
Just
Code:
Dim ArrayString.s(10)

or
Code:
GLOBAL Dim ArrayString.s(10)


I have posted my question on this thread
viewtopic.php?f=4&p=326184#p326184

But like i don't have any answers, Lexvictory advise to me, of create a new thread for only KCC 8)

Thanks for your help

_________________

The happiness is a road, not a destination.
I'm the personaly IDIOTMAN of SROD, and i'm proud of that, it's no much, but it's already an usefulness in this forum.


Last edited by Kwaï chang caïne on Fri Jul 09, 2010 7:15 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Static array in a DLL
PostPosted: Thu Jun 10, 2010 1:15 am 
Offline
PureBasic Bullfrog
PureBasic Bullfrog
User avatar

Joined: Wed Jul 06, 2005 5:42 am
Posts: 5117
Location: Barrie, Ontario
Did you read this in the manual?
Quote:
Notes about creating DLL's:

- The declaration of arrays, linked lists or map with Dim, NewList or NewMap must always be done inside the procedure AttachProcess.

_________________
Veni, vidi, vici.


Top
 Profile  
 
 Post subject: Re: Static array in a DLL
PostPosted: Thu Jun 10, 2010 9:39 am 
Offline
Addict
Addict
User avatar

Joined: Sun Nov 05, 2006 11:42 pm
Posts: 1451
Location: Lyon - France
Hello MASTER

Thanks to answer to me 8)
I must to recognize, that i have not read this instruction :oops:

I don't know if this information is since the beginning, or just for the last version of PB :roll:
But since 5 years, i build DLL, and never do like this :oops: :oops:

Well .... if i have good understand ....(Yes i know, i know, KCC and UNDERSTAND , is not two words, who go really together) :mrgreen:
So, i must declare my array just in GLOBAL in the attachprocess, because LOCAL or STATIC, is personnal dim at my procedure.

So the good code is :D :

Code:
ProcedureDLL AttachProcess(Instance)
Global ArrayString.s(10)
EndProcedure

ProcedureDLL Try()
ArrayString(0) = "Hello"
ProcedureReturn @ArrayString()
EndProcedure


And this code is not good (Pouuaaaaahhh !!!) :(

Code:
ProcedureDLL AttachProcess(Instance)
Dim ArrayString.s(10)
EndProcedure

ProcedureDLL Try()
ArrayString(0) = "Hello"
ProcedureReturn @ArrayString()
EndProcedure


Again thanks, i wish you a good good day, beautiful friend frog 8)

_________________

The happiness is a road, not a destination.
I'm the personaly IDIOTMAN of SROD, and i'm proud of that, it's no much, but it's already an usefulness in this forum.


Top
 Profile  
 
 Post subject: Re: Static array in a DLL
PostPosted: Thu Jun 10, 2010 10:18 am 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 6298
Location: France
Actually both works now, the doc isn't correct (i will changed it).


Top
 Profile  
 
 Post subject: Re: Static array in a DLL
PostPosted: Thu Jun 10, 2010 1:12 pm 
Offline
Addict
Addict
User avatar

Joined: Sun Nov 05, 2006 11:42 pm
Posts: 1451
Location: Lyon - France
God wrote:
Actually both works now

Thanks FRED....

But what both ????

Me... i have three case :(

Apparently this case don't works and it's normal ???? :roll:

Code:
ProcedureDLL Try()
Static Dim ArrayString.s(10)
ArrayString(0) = "Hello"
ProcedureReturn @ArrayString()
EndProcedure


Excuse me for my snail brain :oops:

1/ My first question is : "it's normal that STATIC don't works in my procedure ???"
2/ MASTER Netmaestro say to me : "yes, it's normal, because you not dim in the good place, you must dim your array in attachprocess !!!"
3/ And you say to me : "both works" :shock:

So now..it's hard to understand

Then my first question is :
1/ If my array is simple DIM in the attachprocess like this
Code:
ProcedureDLL AttachProcess(Instance)
Dim ArrayString.s(10)
EndProcedure

Is my array is when even GLOBAL ???? like if i have DIM it like this with GLOBAL ??
Code:
ProcedureDLL AttachProcess(Instance)
Global Dim ArrayString.s(10)
EndProcedure


And my second question is

2/Like Netmaestro say...i don't must declare a static array in my procedure like this ??
ProcedureDLL Try()
Static Dim ArrayString.s(10)
ArrayString(0) = "Hello"
ProcedureReturn @ArrayString()
EndProcedure

Or like this because, even if my declaration is GLOBAL....i can't do this too, because the global is in my procedure and not in the attachprocess ???
ProcedureDLL Try()
Global Dim ArrayString.s(10)
ArrayString(0) = "Hello"
ProcedureReturn @ArrayString()
EndProcedure


I MUST declare it GLOBAL like this and it's the only TWO solution possible
ProcedureDLL AttachProcess(Instance)
Global Dim ArrayString.s(10)
EndProcedure

or
ProcedureDLL AttachProcess(Instance)
Dim ArrayString.s(10)
EndProcedure


Have i good understand this time ??? :oops:

_________________

The happiness is a road, not a destination.
I'm the personaly IDIOTMAN of SROD, and i'm proud of that, it's no much, but it's already an usefulness in this forum.


Top
 Profile  
 
 Post subject: Re: Static array in a DLL
PostPosted: Sat Jun 12, 2010 5:20 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Aug 31, 2005 11:09 pm
Posts: 838
Location: Italy
@KCC

I didn't understand all you wrote (sorry) but:

About the global thing. If you declare an array as Global inside a proc or outside from it to my knowledge there is no difference.

About your 1st question: no, if you declare an array with Dim inside AttachProcess() then it's not global, you must use Global Dim.

About Fred's answer: "actually they both works and doc is not correct" :

My take is he's referring to the apparent fact there is no need do declare a global array inside AttachProcess() even if the doc state this as mandatory. I just tried to declare it inside and outside AttachProcess() and my client program can read back the array returned from a DLL procedure in both cases. But I could be wrong, Fred should clarify that to you. I just assuming this can be a possibility since Fred is saying something in the doc is wrong and my test is saying it works in both ways :)

As you can see viewtopic.php?f=13&t=42537 I have some problem in choosing how to build my DLLs too.

_________________
ACP:COM - ACP:CLR NC
http://luis.no-ip.net/


Top
 Profile  
 
 Post subject: Re: Static array in a DLL
PostPosted: Sat Jun 12, 2010 6:51 pm 
Offline
Addict
Addict
User avatar

Joined: Sun Nov 05, 2006 11:42 pm
Posts: 1451
Location: Lyon - France
Thanks a lot LUIS for you answer 8)

Luis wrote:
I didn't understand all you wrote (sorry) but:

Don't worry, for me too, it's sometime difficult to undestand me :lol:

If someone like you, when your knowledge, have problem .... it's normal that KCC have problem on nearly the same subject :roll:

I don't know why, FRED or NETMAESTRO have not really answer at my question :(
It's very difficult for me to speak english, and furthermore to explain a problem :oops:

But i give "code example", with colors, like a christmas fir tree :mrgreen:
May be, MASTERS do not like Christmas ??? :roll:

So thank you for your explanation for one of my problem 8)

For the next problem, my question is just if it's normal that an STATIC array don't works ???
Code:
ProcedureDLL Try()
Static Dim ArrayString.s(10)
ArrayString(0) = "Hello"
ProcedureReturn @ArrayString()
EndProcedure


Netmaestro say to me, i'm forced to declare all the array of my DLL in the attachprocess in global for be sure that's works... :shock:
But, if i declare it GLOBAL in my procedure, is it good ????

For really answer at my question, can you show to me, ALL the possibility for declaring a string array in a DLL ...please !!! :oops:

I wish you a good day 8)

_________________

The happiness is a road, not a destination.
I'm the personaly IDIOTMAN of SROD, and i'm proud of that, it's no much, but it's already an usefulness in this forum.


Top
 Profile  
 
 Post subject: Re: Static array in a DLL
PostPosted: Sat Jun 12, 2010 7:04 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 24, 2004 2:44 pm
Posts: 3037
Location: Berlin - Germany
I don't understand your wish, but this should work:
Code:
ProcedureDLL Try()
  Static Dim ArrayString.s(10)
  ArrayString(0) = "Hello"
  ProcedureReturn @ArrayString(0)
EndProcedure

Debug PeekS(Try())

or better this:
Code:
ProcedureDLL Try()
  Static ArrayString.s{10}
  ArrayString = "Hello"
  ProcedureReturn @ArrayString
EndProcedure

Debug PeekS(Try())


Top
 Profile  
 
 Post subject: Re: Static array in a DLL
PostPosted: Sat Jun 12, 2010 7:21 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Aug 31, 2005 11:09 pm
Posts: 838
Location: Italy
Me too I cannot understand what you want to do with a pointer to a dynamic array of strings... "ProcedureReturn @ArrayString()"

The first example by ts-soft is to return the FIRST string back, not the base pointer to the full array...is that what you want ? If that's what you want you don't need an array of string but a simple string. Declare it Global (anywhere you like from what I'm seeing, only in AttachProcess() if you want to listen to the docs) and there you go.

To make ts-soft code to work under 4.50 and inside a DLL you should change the static to global tough. Don't know why, especially since you are saying in previous versions of the compiler did work. Again Fred should answer that. Usually a static act as a global with a difference in its access scope. In the case of the DLL it seem, right now, you have to use global to make it work.

Still... I hate the need for that PeekS when using a proto and defining the procedure of type STRING.

_________________
ACP:COM - ACP:CLR NC
http://luis.no-ip.net/


Top
 Profile  
 
 Post subject: Re: Static array in a DLL
PostPosted: Sun Jun 13, 2010 1:11 am 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 6298
Location: France
looks like a bug.


Top
 Profile  
 
 Post subject: Re: Static array in a DLL
PostPosted: Wed Jun 16, 2010 12:27 pm 
Offline
Addict
Addict
User avatar

Joined: Sun Nov 05, 2006 11:42 pm
Posts: 1451
Location: Lyon - France
First ...i want to thanks a lot TsSoft and Luis for your precious help 8)
The life is sometime so hard, when i'm alone ahead my computer, with all his "Boing...boinnng boinnngboinnng" :(
And also ....his nice red ribbons, everywhere on my code :oops:
Fortunately, i have always friends, to help and push KCC, to the next "Boing...boinnng boinnngboinnng" 8)

TsSoft wrote:
I don't understand your wish, but this should work:

Luis wrote:
Me too I cannot understand what you want to do with a pointer to a dynamic array of strings

That what i want, is to send the adress of the array, by the DLL, for use it in an exe VB6.
Thats works perfectly with all the old version, and begin to bug since the new versions :(

The first time, they are a bug at the compilation, and FRED fix it.
But now, there is a bug with a ribbon red

God wrote:
looks like a bug.

And i believe that i have the same advice :roll:

Because even the code of Ts Soft don't works, when i compiled the DLL
This code works only in the same code, not with a DLL and an EXE :(

The code that i use is the first version of TsSoft

Dll
Code:
ProcedureDLL Try()
  Static Dim ArrayString.s(10)
  ArrayString(0) = "Hello"
  ProcedureReturn @ArrayString(0)
EndProcedure

Exe
Code:
If OpenLibrary(0, "C:\Try.dll")
*Pointeur = CallFunction(0, "Try")
Debug PeekS(*Pointeur)
EndIf


I have a red line in the exe, at the line
Code:
*Pointeur = CallFunction(0, "Try")


So if i replace this line
Static Dim ArrayString.s(10)
by this line
Global Dim ArrayString.s(10)

Thats works :shock:

So it's the reason why i think it is really a problem of STATIC :roll:

_________________

The happiness is a road, not a destination.
I'm the personaly IDIOTMAN of SROD, and i'm proud of that, it's no much, but it's already an usefulness in this forum.


Top
 Profile  
 
 Post subject: Re: Static array in a DLL
PostPosted: Fri Jul 09, 2010 7:11 pm 
Offline
Addict
Addict
User avatar

Joined: Sun Nov 05, 2006 11:42 pm
Posts: 1451
Location: Lyon - France
Hello FRED.

I see you are in full job :D
Black of [Done][Done][Done][Done][Done] everywhere.... :shock:

And not [Done] with the little word in red Fred at right on this post :(

You have say yourself
god wrote:
looks like a bug.

So is it a bug, not a bug, you fixed that later, or never ????
Can you give me some news Pleaaaaseeeee ! :mrgreen:

Signed "The little nut cracker" :oops:

_________________

The happiness is a road, not a destination.
I'm the personaly IDIOTMAN of SROD, and i'm proud of that, it's no much, but it's already an usefulness in this forum.


Top
 Profile  
 
 Post subject: Re: Static array in a DLL [Freeeeed cooooucouuu!!!]
PostPosted: Sat Jul 10, 2010 10:48 am 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 6298
Location: France
Please don't do this, it's annoying, thank you.


Top
 Profile  
 
 Post subject: Re: Static array in a DLL
PostPosted: Sun Jul 11, 2010 8:50 am 
Offline
Addict
Addict
User avatar

Joined: Sun Nov 05, 2006 11:42 pm
Posts: 1451
Location: Lyon - France
Quote:
Please don't do this, it's annoying, thank you.

It's perhaps annoying, but it's also annoying to be without news. :?
I ask not to much, just some news, have i not the right ?????? :shock:
My last question is old of a month :?
I'm not patient enough ???

You don't like speak too much, you have the right :roll:
You have too much job, with your langage, i know that 8)

But when a client ask to you a question, even if it's a bad client, who don't understand anything, you must answer it correctly, and above all completely :?
it's a rule of busisness.....but mostly a rule of etiquette :roll:

My question, is not create for disturbing you and not for laughing, it's a serious question, asked with perhaps a little bit of humor and politeness :?
Everybody know here, that it's my constant behaviour, someone hate me, some one like me for the same reason, it's like that...Kcc is like that, in the world, they are all of people style :oops:

So, if i bored you, you must to know, that it's also annoyed to be before his PC, have a problem, and don't know, if it's the fault of me or of PB :?

I'm null, everybody know that, so i lost too much time with my bad code, all the day :oops:
But sometime numerous days are lost the fault of bug.... the jpg picture for example and other..
So it's the reason why the comprehension must to be to the both sizes, don't you believe ???? :roll:

Nobody do never error, you works hard for your langage, and i thank you all the day for that, but think just a moment, that some persons like me, have not your sprit of analysis, not your studies, and not understand the things like you :oops:

I have annoyed you.....it's not my intention, so for proof that, i want excuse me :oops:
But you are not correct, your answer would be a style of this:

I have not again the time to look, but i do it later
But please don't do this, for the futur time, it's annoying, thank you.
:wink:

Or that

It's not a bug, i have look the problem, it's the normal behaviour
But please don't do this, for the futur time, it's annoying, thank you. :wink:


Or that

I have see the problem, but noy again fix it
But don't worry.....it s fixed in the next versiion
But please don't do this, for the futur time, it's annoying, thank you. :wink:


if i have do this, it's justly for not offense you, you must believe me, not put the pressure, ask news, but with a little humor touch :oops:
It's just that, i wait for a long time, to have an full answer of you, just that, nothing else :?

You feel offensed :oops:
You have offense me :?
One everywhere, the ball at the center

Despite my injury, my admiration for you and your team is always also big 8)
We are perhaps not even part of the world.
It is not easy to understand in these circumstances, and especially by text interposed
:(
My text is too long like usually, and i don't wait an full answer of you, like usuually too :wink:

Thank you !!!!!!

This subject is very important for me, and for be sure not create better misunderstanding, this is the translate (or nearly :oops:) in french :oops:

C'est peut-être ennuyeux, mais il est tout aussi ennuyeux d'être dans l'incertitude.
Je ne demande pas grand-chose, juste quelques nouvelles, n'ai je pas le droit ??????
Ma dernière question est vieille d'un mois, ne suis je pas assez patient???

Tu n'aimes pas trop parler, et c'est ton droit :roll:
Tu es débordé avec ton langage, et je le sais 8)

Mais quand un client pose une question, même si c'est un mauvais client, qui ne comprend jamais rien, et que tu regrettes tous les jours l'encaissement de son cheque, tu doit quand meme lui répondre correctement, et surtout complètement
Lui donner des reponses comprehensives, meme si pour cela il faut que tu ecrives plus de deux mots
c'est une règle de ..... busisness, mais surtout une règle de savoir vivre

Ma question n'etait pas faites pour t'ennuyer, ni pour ammuser la galerie, c'est une question sérieuse, mais demandée avec politesse et un peu d'humour (Enfin c'est ce que je croyais naivement)
Tout le monde sait ici, que c'est ma maniere de m'exprimer, je tape sur les nerfs de certains, et d'autres me felicitent et m'encouragent que ce soit en MP ou sur le forum à continuer pour ce que j'apporte au forum, c'est comme ça, Kcc ... est comme ça, et il faut de tout pour faire un monde, meme des "tanches" comme moi.

Donc, si je t'ennuie, j'aimerais juste que tu saches ce que c'est d'etre devant son PC, avec un cerveau qui fait un bruit d'evier, tout seul avec un problème, et ne pas savoir si c'est ma faute ou celle de PB

Je suis nul, tout le monde le sait, je perd deja tellement de temps tous les jours avec mes codes foireux, mais parfois c'est pas de ma faute, comme pour les jPG par exemples et d'autres bugs reconnus de PB
C'est pour cette raison que je pense que la compréhension doit être des deux cotés, ne crois tu pas ????

L'erreur est humaine, tu travailles dur pour ton langue, et je t'en remercie tous les jours pour cela, mais pense un instant, que certaines personnes comme moi, n'ont pas ton esprit d'analyse, et ton niveau d'études, et n'arrivent pas a comprendre ce qui pour toi est le B-A-BA

Je t'ai véxé aujourd'hui ou peut etre meme surement un autre jours, et peut etre que tu m'en veux ..... ce n'etait surtout pas mon intention, et pour te le prouver, je m'en excuse si c'est le cas

Mais il n'en reste pas moins que ta reponse reste à mon avis incorrecte, j'aurais pensé au pire avoir ce style de reponses :

Je n'ai pas encore eu le temps de regarder, mais je vais le faire plus tard
Mais s'il te plaît evite ce genre d'appel a l'avenir, c'est ennuyeux, je te remercie.


Ou bien

Ce n'est pas un bug, j'ai regardé le problème, c'est le comportement normal, corrige ton code (un petit example aurait été genial)
Mais s'il te plaît evite ce genre d'appel a l'avenir, c'est ennuyeux, je te remercie.


Ou bien

J'ai vu le problème, mais pas pu encore le corriger
Mais ne t'inquiéte pas ..... ce sera fait dans la prochaine version
Mais s'il te plaît evite ce genre d'appel a l'avenir, c'est ennuyeux, je te remercie.


Si j'ai fait comme ça ce n'est pas pour te vexer, tu dois me croire, mais pour ne pas te mettre la pression, juste demander des nouvelles, avec une touche d'humour à la kCC (tu fais donc partie du groupe de gens qui ne m'appprecient pas)

C'est juste que, j'attends depuis longtemps, d'avoir une réponse complete de toi, et rien d'autre

Tu t'es senti agréssé :oops:
Tu m'as véxé :?

Un partout, la balle au centre

Il n'en reste pas moins que malgré ma blessure, mon admiration pour toi et ton equipe reste intacte.
Nous ne faisons peut etre pas partie du meme monde.
Ce n'est pas facile de se comprendre dans ces conditions, et surtout par texte interposés :(


Comme d'habitude j'ai été trop long et je m'en excuse, mais comment faire passer tant de sentiments en quelques mots, c'est deja assez dur en quelques lignes.
Notre incomprehension commence deja par la :(
Je n'attend pas de reponses de toi, tout du moins pas complete :lol:, rassure toi, comme d'habitude aussi :wink:

Merci !!!!!!

_________________

The happiness is a road, not a destination.
I'm the personaly IDIOTMAN of SROD, and i'm proud of that, it's no much, but it's already an usefulness in this forum.


Top
 Profile  
 
 Post subject: Re: Static array in a DLL
PostPosted: Tue Jul 20, 2010 5:10 pm 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 6298
Location: France
Fixed.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye