[RESOLU] POLINK ERROR

Vous débutez et vous avez besoin d'aide ? N'hésitez pas à poser vos questions
Avatar de l’utilisateur
Progi1984
Messages : 2659
Inscription : mar. 14/déc./2004 13:56
Localisation : France > Rennes
Contact :

[RESOLU] POLINK ERROR

Message par Progi1984 »

Désolé de ne pas trouver de titre plus explicite....

Mais tout d'abord voici le bout de code me posant problème :

Code : Tout sélectionner

Import "C:\Perso\PureBasic\Compilers\ObjectManager.lib"
  Object_GetOrAllocateID (Objects, Object.l) As "_PB_Object_GetOrAllocateID@8"
  Object_GetObject       (Objects, Object.l) As "_PB_Object_GetObject@8"
  Object_IsObject        (Objects, Object.l) As "_PB_Object_IsObject@8"
  Object_EnumerateAll    (Objects, ObjectEnumerateAllCallback, *VoidData) As "_PB_Object_EnumerateAll@12"
  Object_EnumerateStart  (Objects) As "_PB_Object_EnumerateStart@4"
  Object_EnumerateNext   (Objects, *object.Long) As "_PB_Object_EnumerateNext@8"
  Object_EnumerateAbort  (Objects) As "_PB_Object_EnumerateAbort@4"
  Object_FreeID          (Objects, Object.l) As "_PB_Object_FreeID@8"
  Object_Init            (StructureSize.l, IncrementStep.l, ObjectFreeFunction) As "_PB_Object_Init@12"
  Object_GetThreadMemory (MemoryID.l) As "_PB_Object_GetThreadMemory@4"
  Object_InitThreadMemory(Size.l, InitFunction, EndFunction) As "_PB_Object_InitThreadMemory@12"
EndImport
Structure S_Test
  Id.l
  Tmp.l
EndStructure
;- Macros
;{
Macro Test_ID(object)
  Object_GetObject(TestObjects, object)
EndMacro
Macro Test_IS(object)
  Object_IsObject(TestObjects, object) 
EndMacro
Macro Test_NEW(object)
  Object_GetOrAllocateID(TestObjects, object)
EndMacro
Macro Test_FREE(object)
  If object <> #PB_Any And Test_IS(object) = #True
    Object_FreeID(TestObjects, object)
  EndIf
EndMacro
Macro Test_INITIALIZE(hCloseFunction)
  Object_Init(SizeOf(S_Test), 1, hCloseFunction)
EndMacro
;}
;- System
Procedure TestFree(Id.l)
  Shared TestObjects
  Protected *Test.S_Test
  If Id <> #PB_Any And Test_IS(Id)
   *Test = Test_ID(Id)
  EndIf
  If *Test
   Test_FREE(Id)
  EndIf
  ProcedureReturn #True
EndProcedure
ProcedureDLL Test_Init()
  Shared TestObjects 
  TestObjects = Test_INITIALIZE(@TestFree()) 
EndProcedure

Test_Init()
Avec le débuggueur, pas de problème !
Sans le débuggueur :

Code : Tout sélectionner

POLINK : error : Unresolved external symbol '_PB_SimpleList_Add'.
POLINK : error : Unresolved external symbol '_PB_SimpleList_Remove'.
POLINK : fatal error : 2 unresolved external(s).
Si on commente l'utilisation des macros, pas les macros elle meme, pas de problème mais bon :p

Merci de votre aide
Dernière modification par Progi1984 le mer. 18/avr./2007 8:17, modifié 2 fois.
brossden
Messages : 833
Inscription : lun. 26/janv./2004 14:37

Message par brossden »

Bonjour Progi1984

Il me manque le fichier "ObjectManager.lib" pour t'aider peux tu le mettre en lien ?
Denis

Bonne Jounée à tous
Avatar de l’utilisateur
Progi1984
Messages : 2659
Inscription : mar. 14/déc./2004 13:56
Localisation : France > Rennes
Contact :

Message par Progi1984 »

Excuse moi ! Quelle version de PB utilises tu ? Moi, c'était fourni avec la V4.02 !
brossden
Messages : 833
Inscription : lun. 26/janv./2004 14:37

Message par brossden »

Ok c'etait juste la directry qui ne collait pas avec mon PC !

Je ne connais pas cette lib ..
Je vais essayer se jeter un oeil quand même !
Denis

Bonne Jounée à tous
Avatar de l’utilisateur
Progi1984
Messages : 2659
Inscription : mar. 14/déc./2004 13:56
Localisation : France > Rennes
Contact :

Message par Progi1984 »

Recherche "Gestion des objets" par Dri !
Avatar de l’utilisateur
Progi1984
Messages : 2659
Inscription : mar. 14/déc./2004 13:56
Localisation : France > Rennes
Contact :

Message par Progi1984 »

Avatar de l’utilisateur
Progi1984
Messages : 2659
Inscription : mar. 14/déc./2004 13:56
Localisation : France > Rennes
Contact :

Message par Progi1984 »

Fred m'a répondu...

Code corrigé :

Code : Tout sélectionner

Import "C:\Perso\PureBasic\Compilers\ObjectManager.lib"
  Object_GetOrAllocateID (Objects, Object.l) As "_PB_Object_GetOrAllocateID@8"
  Object_GetObject       (Objects, Object.l) As "_PB_Object_GetObject@8"
  Object_IsObject        (Objects, Object.l) As "_PB_Object_IsObject@8"
  Object_EnumerateAll    (Objects, ObjectEnumerateAllCallback, *VoidData) As "_PB_Object_EnumerateAll@12"
  Object_EnumerateStart  (Objects) As "_PB_Object_EnumerateStart@4"
  Object_EnumerateNext   (Objects, *object.Long) As "_PB_Object_EnumerateNext@8"
  Object_EnumerateAbort  (Objects) As "_PB_Object_EnumerateAbort@4"
  Object_FreeID          (Objects, Object.l) As "_PB_Object_FreeID@8"
  Object_Init            (StructureSize.l, IncrementStep.l, ObjectFreeFunction) As "_PB_Object_Init@12"
  Object_GetThreadMemory (MemoryID.l) As "_PB_Object_GetThreadMemory@4"
  Object_InitThreadMemory(Size.l, InitFunction, EndFunction) As "_PB_Object_InitThreadMemory@12"
EndImport
Structure S_Test
  Id.l
  Tmp.l
EndStructure
;- Macros
;{
Macro Test_ID(object)
  Object_GetObject(TestObjects, object)
EndMacro
Macro Test_IS(object)
  Object_IsObject(TestObjects, object)
EndMacro
Macro Test_NEW(object)
  Object_GetOrAllocateID(TestObjects, object)
EndMacro
Macro Test_FREE(object)
  If object <> #PB_Any And Test_IS(object) = #True
    Object_FreeID(TestObjects, object)
  EndIf
EndMacro
Macro Test_INITIALIZE(hCloseFunction)
  Object_Init(SizeOf(S_Test), 1, hCloseFunction)
EndMacro
;}
;- System
Procedure TestFree(Id.l)
  Shared TestObjects
  Protected *Test.S_Test
  If Id <> #PB_Any And Test_IS(Id)
   *Test = Test_ID(Id)
  EndIf
  If *Test
   Test_FREE(Id)
  EndIf
  ProcedureReturn #True
EndProcedure
ProcedureDLL Test_Init()
  Shared TestObjects
  TestObjects = Test_INITIALIZE(@TestFree())
  If IsWindow(#PB_Any)
  EndIf
EndProcedure

Test_Init()
brossden
Messages : 833
Inscription : lun. 26/janv./2004 14:37

Message par brossden »

Tu pourrais nous donner les explications de Fred ?
je n'ai pas envie de comparer ligne à ligne les deux codes !!

Merci !
Denis

Bonne Jounée à tous
Avatar de l’utilisateur
Progi1984
Messages : 2659
Inscription : mar. 14/déc./2004 13:56
Localisation : France > Rennes
Contact :

Message par Progi1984 »

Oh excuse moi, j'ai zappé ca :? !

En fait, le débuggeur inclut quelques libs PB (dont SimpleList), donc il fallait que j'inclus une commande utilisant cette lib.

Fred m'a conseillé ca pour ce code

Code : Tout sélectionner

End
CloseWindow(0)


Mais vu que c'est pour une lib, j'ai préfèré un code propre et évitant les ambiguités :

Code : Tout sélectionner

ProcedureDLL Test_Init()
  Shared TestObjects
  TestObjects = Test_INITIALIZE(@TestFree())
EndProcedure 
devient

Code : Tout sélectionner

ProcedureDLL Test_Init()
  Shared TestObjects
  TestObjects = Test_INITIALIZE(@TestFree())
  If IsWindow(#PB_Any)
  EndIf
EndProcedure 
brossden
Messages : 833
Inscription : lun. 26/janv./2004 14:37

Message par brossden »

Merci Progi1984 et Merci à Fred par la même occasion !
Denis

Bonne Jounée à tous
Répondre