It is currently Mon Jan 20, 2020 12:48 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: [Done] Issue with imported functions
PostPosted: Wed Jul 13, 2011 9:14 am 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Apr 26, 2003 8:27 am
Posts: 4229
Location: Strasbourg / France
Code snippet to demonstrate the issue (Tailbite 1.4.7 / PB 4.60 BETA3 / Win XP x86) :
Code:
Import "zlibwapi.lib" ; zlib from http://www.winimage.com/zLibDll/zlib123dll.zip
   fclose_file_func() As "_fclose_file_func"
   ferror_file_func() As "_ferror_file_func"
   fopen_file_func() As "_fopen_file_func"
   fread_file_func() As "_fread_file_func"
   fseek_file_func() As "_fseek_file_func"
   ftell_file_func() As "_ftell_file_func"
   fwrite_file_func() As "_fwrite_file_func"
EndImport
Structure pzlib_filefunc_def
  zopen_file.l
  zread_file.l
  zwrite_file.l
  ztell_file.l
  zseek_file.l
  zclose_file.l
  zerror_file.l
  opaque.l
EndStructure
ProcedureDLL Dummy()
  zFileFunctions.pzlib_filefunc_def
  zFileFunctions\zopen_file = @fopen_file_func()
  zFileFunctions\zread_file = @fread_file_func()
  zFileFunctions\zwrite_file = @fwrite_file_func()
  zFileFunctions\ztell_file = @ftell_file_func()
  zFileFunctions\zseek_file = @fseek_file_func()
  zFileFunctions\zclose_file = @fclose_file_func()
  zFileFunctions\zerror_file = @ferror_file_func()
  zFileFunctions\opaque = #Null
EndProcedure


Tailbite wrote:
FAsm: Dummy.asm
Error
Line no: 22
Error code: -122
Error String: UNDEFINED_SYMBOL

Dummy.asm wrote:
...
zFileFunctions\zopen_file = @fopen_file_func()
MOV eax,_fopen_file_func <----------------
...
I think "EXTRN _fopen_file_func" is missing in Dummy.asm

Workaround :
Code:
Import "zlibwapi.lib" ; zlib from http://www.winimage.com/zLibDll/zlib123dll.zip
   fclose_file_func() As "_fclose_file_func"
   ferror_file_func() As "_ferror_file_func"
   fopen_file_func() As "_fopen_file_func"
   fread_file_func() As "_fread_file_func"
   fseek_file_func() As "_fseek_file_func"
   ftell_file_func() As "_ftell_file_func"
   fwrite_file_func() As "_fwrite_file_func"
EndImport
Structure pzlib_filefunc_def
  zopen_file.l
  zread_file.l
  zwrite_file.l
  ztell_file.l
  zseek_file.l
  zclose_file.l
  zerror_file.l
  opaque.l
EndStructure
ProcedureDLL Dummy()
  ;{ Tailbite workaround !
  If 0 = 1
    fopen_file_func()
    fread_file_func()
    fwrite_file_func()
    ftell_file_func()
    fseek_file_func()
    fclose_file_func()
    ferror_file_func()
  EndIf ;}
  zFileFunctions.pzlib_filefunc_def
  zFileFunctions\zopen_file = @fopen_file_func()
  zFileFunctions\zread_file = @fread_file_func()
  zFileFunctions\zwrite_file = @fwrite_file_func()
  zFileFunctions\ztell_file = @ftell_file_func()
  zFileFunctions\zseek_file = @fseek_file_func()
  zFileFunctions\zclose_file = @fclose_file_func()
  zFileFunctions\zerror_file = @ferror_file_func()
  zFileFunctions\opaque = #Null
EndProcedure

_________________
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).


Top
 Profile  
Reply with quote  
 Post subject: Re: Issue with imported functions
PostPosted: Wed Jul 13, 2011 9:32 pm 
Offline
Addict
Addict

Joined: Sat Apr 10, 2004 1:20 pm
Posts: 1143
Location: Germany
Hi Gnozal,

have you tried compiling it with the PB-IDE ?

I get this error message on compiling it :

Image

BR Klaus


Top
 Profile  
Reply with quote  
 Post subject: Re: Issue with imported functions
PostPosted: Wed Jul 13, 2011 10:59 pm 
Offline
Addict
Addict

Joined: Sat Apr 10, 2004 1:20 pm
Posts: 1143
Location: Germany
the 'MOV EAX,_Imported_Function' is ignored by TailBite, only a MOV or JMP (like in your workaround) is triggering the ExternalProc().

This version should fix it : http://www.tailbite.com/downloads/TailBiteV1.4.8.zip

Please test it and report back here ;-)

BR Klaus


Top
 Profile  
Reply with quote  
 Post subject: Re: Issue with imported functions
PostPosted: Thu Jul 14, 2011 7:25 am 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Sat Apr 26, 2003 8:27 am
Posts: 4229
Location: Strasbourg / France
Thank you, it works.

_________________
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


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