Page 1 of 3

Tool to import static librarys into PB

Posted: Wed Mar 03, 2004 12:20 am
by freak
Hi folks,

I had the idea for this quite a while ago, but never started it. Now, that
Karbon brought it back to my mind, i took some time today, and coded this.

A little tool, that let's you import a static lib (*.lib or *.obj) as a PureLibrary
into PB. So you can call them directly as PB functions. (you can even
customize the function names)

It's no big deal actually, just a little wrapper creator, but still quite usefull.
Get it at my site: http://freak.purearea.net/tools/
(make sure you read the 'readme.txt')

Consider this thing in beta stage. I haven't got that much static librarys to
properly test it. If you experience any trouble, please tell me.

Timo

Re: Tool to import static librarys into PB

Posted: Wed Mar 03, 2004 2:11 am
by NoahPhense
freak wrote:Hi folks,

I had the idea for this quite a while ago, but never started it. Now, that
Karbon brought it back to my mind, i took some time today, and coded this.

A little tool, that let's you import a static lib (*.lib or *.obj) as a PureLibrary
into PB. So you can call them directly as PB functions. (you can even
customize the function names)

It's no big deal actually, just a little wrapper creator, but still quite usefull.
Get it at my site: http://freak.purearea.net/tools/
(make sure you read the 'readme.txt')

Consider this thing in beta stage. I haven't got that much static librarys to
properly test it. If you experience any trouble, please tell me.

Timo
Sweet..

- np

Posted: Wed Mar 03, 2004 2:27 am
by Karbon
I just tried to import the eSellerate static lib (from the free SDK on their homepage - http://www.esellerate.net) and it just hangs after opening the "Importing Library. Please wait..." window.

It does seem to have created a small (5k) userlib.. Testing to see if it works now.

Posted: Wed Mar 03, 2004 2:39 am
by Karbon
Nope, no dice :-(

I get a "eSellerate_WebStore" is not a function, array or linked list error

Posted: Wed Mar 03, 2004 7:53 am
by Dare2
This has some really awesome potential.

Many thanks!

Posted: Wed Mar 03, 2004 8:33 am
by Dare2
Hiya freak,

Tried this with the FPU.lib available with masm32.

First time hung, because I did not put () around my args in the IDE statusbar help field.

Second time created the library FPU, which I put into the userlibraries folder. I closed all pbeditor windows, reopened, and tried.

Same result as Karbon - "realXadd is not a function, array or linked list" where realXadd is the alias for fpuAdd. Same result using fpuAdd.

OS is win2000pro, all SP and updates in place.

Hope this is a small fix as having this will really rock!

Posted: Wed Mar 03, 2004 8:55 am
by ricardo
Nice idea!!!!

Im testing this tool that converts ANY dll into a lib:

http://www.binary-soft.com/dll2lib/dll2lib.htm

I convert the dynaload into a lib and will try to test with it.

At the moment im trying to use your tool but it seams to freeze (i will wait a little more)...

BTW, where does ned to point the LibMaker Path? To lib sdk?

:P

Posted: Wed Mar 03, 2004 9:26 am
by PolyVector
Freak... I have some code for ya:

Code: Select all

If FreakFinishesThisProg
    PayFreak($FFFF)
Else
    PayFreak(#NULL)
EndIf

Posted: Wed Mar 03, 2004 1:49 pm
by freak
I have uploaded a new version with a few changes ( http://freak.purearea.net/tools/ )
It now outputs the current status, so you'll know where it hangs (most probably when calling Librarymaker.exe)
I added also some more checks to prevent the QuickHelp problems.

If you can't make it work for a specific lib, provide me with a download link,
and i'll try if there is a bug in my tool. Works find for me so far.
See below for a detailed example of usage.

Note: If you only get one PureLib created, then there is something wrong.
You need to have one called like the original file (just no extension), and
one with the same name, but "_wrapper" behind it.
Both are required (one contains the PB functions, the other the real lib)

Karbon:
Sorry, i can't test your lib. They want me to register just to get the demo,
and i don't like that much. Maybe the information below helps a bit.

Dare2
I downloaded masm32 from the net, and converted the lib wihout any
trouble.
Here is a detailed description of what i did:

download url:
http://www.masm32.com/masmdl.htm

Paths:
PBCompiler = C:\PureBasic\Compilers\
LibraryMaker = C:\PureBasic\Library SDK\
UserLibraries = C:\PureBasic\PureLibraries\UserLibraries\
Temp = B:\ (this is my ramdisk)

Note: the first needs to be the path where Fasm.exe is located (PB compilers path)
the second needs to be where the LibraryMaker.exe tool is located (Library SDK)
the next is the output directory
the last should be a temp directory. Make sure, there are no other .desc
files in that directory. Otherwise the LibraryMaker thinks, these need to be
converted too, and probably hangs.

Source File: C:\masm32\LIB\fpu.lib

Functions:
original name: FpuAdd
alias: realXadd
parameters: 4

original name: FpuFLtoA
alias: realXstr
parameters: 4

Is just used "()" as quickhelp for now.

When converting, i get the 2 files:
Fpu
Fpu_wrapper

After restarting PB, the following code worked fine:

Code: Select all

realXadd(123, 321, 0, 8|2048|128)
result$ = Space(25)
realXstr(0, 5, @result$, 1|2048)
Debug result$
I hope this helps a bit. If you can't make it work, please tell me exactly
what you did.

ricardo
the LibMaker Path needs to point to the LibraryMaker.exe tool in the
PB LibrarySDK folder.


That's it..

Timo

Posted: Wed Mar 03, 2004 2:22 pm
by Karbon
http://www.esellerate.net/downloads/eSellerateSDK.exe <- direct download

I'll try the newest version tonight.. Thanks!

Posted: Wed Mar 03, 2004 2:35 pm
by Dare2
Hi Freak,

Thanks for that.
I downloaded masm32 from the net, and converted the lib wihout any trouble.

That is one big download. 8O I should have given a link to just the fpu.lib, sorry. But there are heaps of goodies in the masm package, so I hope that offsets the effort you went to. Appreciate that.

My original error was ( :oops: ) I did not copy the wrapper part into the userlibrary folder (I set destination to a temp directory under that folder, and just copied up 1 file, fpu).

Will get your newest version and start playing. A whole new world has opened up!

I am one happy chappy! :D :D :D

Posted: Wed Mar 03, 2004 3:08 pm
by freak
Dare2 wrote:That is one big download. 8O I should have given a link to just the fpu.lib, sorry. But there are heaps of goodies in the masm package, so I hope that offsets the effort you went to. Appreciate that.
No problem, only took about a minute on broadband. 8)

> I am one happy chappy! :D :D :D

Nice to hear :)


Karbon:
I had a look at the thing, and it seems to convert fine,
However, this stuff is a bit complex, so i can't quickly test it now.


Timo

Posted: Wed Mar 03, 2004 3:53 pm
by Karbon
No worries. As long as it didn't hang on you I'll try it tonight and report back to you if it fails..

THANKS!

Posted: Wed Mar 03, 2004 7:39 pm
by ricardo
Hi,

I use your app for the dynaload.lib, i get the lib on my users lib.. but when try to run it get the next error message for every function:

1.obj.text: undefinded reference to '_DL_LoadLibrary@8'

I found the wrapper, but its only 1 k and the lib is 24 k.


Thanks in advance!!

The lib: http://www.getafile.com/cgi-bin/merlot/ ... YNLOAD.zip

Posted: Wed Mar 03, 2004 7:52 pm
by Num3
WOW!

Nice one!

Freak, i'll vote for you for President !!!