Lib2PBImport Version 1.2

Developed or developing a new product in PureBasic? Tell the world about it.
Denis
Enthusiast
Enthusiast
Posts: 778
Joined: Fri Apr 25, 2003 5:10 pm
Location: Doubs - France

Post by Denis »

Many Thks

:D

Denis
A+
Denis
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

Small Update: (1.2)
Added a Statusbar with UnDecorateSymbolName of C++ Symbols, if selected
This is only usefull for c++ programmer
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

Post by SFSxOI »

Doesn't seem to be producing macros for me. I get the code for the .pbi with the decorated functions but never see any macros. I'm using v1.2, it was the same with v1.0.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

Macros only if checked and on stdcall libs by ms, kernel32.lib for example
Most libs doesn't have ansi and unicode versions with A or W at the end.
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

Post by SFSxOI »

Ahhhh...OK I see. I was confused as the information in the thread seemed to indicate that macros could be produced from any converted .lib, thanks ts-soft. Its a very nice tool. :)
ts-soft wrote:Macros only if checked and on stdcall libs by ms, kernel32.lib for example
Most libs doesn't have ansi and unicode versions with A or W at the end.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

Small Update

Missing CloseFile() added :oops:
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Tipperton
Addict
Addict
Posts: 1286
Joined: Thu Jun 19, 2003 7:55 pm

Post by Tipperton »

Is this still available?

Download link in first post returns 404 file not found.

Thanks!
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

Tipperton wrote:Is this still available?

Download link in first post returns 404 file not found.

Thanks!
I will upload it on my new webspace, next days, sry ...
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Tipperton
Addict
Addict
Posts: 1286
Joined: Thu Jun 19, 2003 7:55 pm

Post by Tipperton »

No problem, and thanks! :)
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

New download link on first post (no changes!)
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Lib2PBImport Version 1.2

Post by Kwai chang caine »

Thanks TS-Soft for this useful tools 8)

But i have a little problem
Is it normal that when i have a procedure with string parameter, your tools create a integer parameter for the same procedure :shock:

Code: Select all

Import
 Function(a.l) As "_Function@4"
EndImport

Procedure Function(Parameter.s)
 ..
 ..
 ..
End Procedure
ImageThe happiness is a road...
Not a destination
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: Lib2PBImport Version 1.2

Post by srod »

Kwai,

import libraries do not generally hold information regarding the types of individual parameters (C++ name mangling aside!).

The only information which can be obtained from a PB generated import library is the number of parameters taken by individual functions.

All you have to do is modify the code generated by ts-soft's tool yourself as appropriate.
I may look like a mule, but I'm not a complete ass.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Lib2PBImport Version 1.2

Post by Kwai chang caine »

Hello MASTER glad to talk to you, there is a long time :D
I suppose you are in vacancy without KCC :mrgreen:
But it's finish......i'm here :D

I have like usually several questions :oops:

1/ Am i forced to write this As "_Function@X" after each fonction,

Code: Select all

Import "Dll.lib"
 Function(a.s) As "_Function@X"
EndImport
or just this is sufficient ?? :roll:

Code: Select all

Import "Dll.lib"
 Function(a.s)
EndImport
2/If i want return a string value from my DLL and want use import/endimport
This code is the more simple to do this ??? :roll:

Code: Select all

Import "Dll.lib"
 MyFunctionInTheDll(a.s)
EndImport

Procedure.s MyFunctionInExe(Sentence.s)
 ProcedureReturn PeekS(MyFunctionInTheDll(Sentence))
EndProcedure

Debug MyFunctionInExe("Hello Kcc")
ImageThe happiness is a road...
Not a destination
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: Lib2PBImport Version 1.2

Post by srod »

Kwaï chang caïne wrote:1/ Am i forced to write this As "_Function@X" after each fonction,

Code: Select all

Import "Dll.lib"
 Function(a.s) As "_Function@X"
EndImport
or just this is sufficient ?? :roll:

Code: Select all

Import "Dll.lib"
 Function(a.s)
EndImport
For STDCALL dll's, either would be fine (at least with PB x86). I always use the first so that I know where I stand.

2/If i want return a string value from my DLL and want use import/endimport
This code is the more simple to do this ??? :roll:

Code: Select all

Import "Dll.lib"
 MyFunctionInTheDll(a.s)
EndImport

Procedure.s MyFunctionInExe(Sentence.s)
 ProcedureReturn PeekS(MyFunctionInTheDll(Sentence))
EndProcedure

Debug MyFunctionInExe("Hello Kcc")
Yes providing the dll returns a global or static string. This is not a threadsafe way of doing it though. Use buffers to be absolutely safe.
I may look like a mule, but I'm not a complete ass.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Lib2PBImport Version 1.2

Post by Kwai chang caine »

My great MASTER wrote:Use buffers to be absolutely safe
:shock:
Where is this buffer ????? :shock:
Have you a little example of him ??? :roll:
ImageThe happiness is a road...
Not a destination
Post Reply