No functions found in a DLL

Just starting out? Need help? Post your questions and find answers here.
Quark
New User
New User
Posts: 6
Joined: Sun Dec 08, 2024 4:58 pm

No functions found in a DLL

Post by Quark »

PureBasic 6.12 LTS (Windows - x64) and also x32

Hi,

Just a newbie to PB struggling with simple things...
I just would like to access the functions of a DLL.
Here is my code:

Code: Select all

		LibNum = 1 
		LibHandle = OpenLibrary(LibNum,"TWSLib.dll")

		Result = IsLibrary(LibNum)
		Result = LibraryID(LibNum)
		Result = CountLibraryFunctions(LibNum)
This code works fine till the last line that returns 0. Previous functions return large positive numbers.

I used a DLL viewer such as "DLL Export Viewer" that displayed nothing at all.
An online tool "https://speedtesting.herokuapp.com/peviewer/" showed some kind of header (valid or not, I dont know) but no functions at all.

Of course the purebasic function "ExamineLibraryFunctions" does not report any functions
Why is that I cannot access the functions of this DLL ? Maybe they are just not there...

Thanking you in advance for any help
User avatar
jacdelad
Addict
Addict
Posts: 1993
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Re: No functions found in a DLL

Post by jacdelad »

Where is the DLL from? Is it 32 or 64 bit?
Good morning, that's a nice tnetennba!

PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
Quark
New User
New User
Posts: 6
Joined: Sun Dec 08, 2024 4:58 pm

Re: No functions found in a DLL

Post by Quark »

>Where is the DLL from? Is it 32 or 64 bit?

I think it is 32 bit but I am not sure. Does this make a difference?
It comes with TWS API installation, that is an API for interfacing with "Interactive Brokers" broker (financial info, placing orders, etc).
normeus
Enthusiast
Enthusiast
Posts: 470
Joined: Fri Apr 20, 2012 8:09 pm
Contact:

Re: No functions found in a DLL

Post by normeus »

They do have a Web api which PureBasic should be able to handle easily. ( or with some effort anyway )

"TWSLib.dll" is a C# dll. You should have a "TWSLib64.tlb" and a "TWSLib32.tlb, but I have no idea how to load that to be useful with PB.
Dealing with objects with PB can be stress inducing to say the least. Stick with their web interface or think about using C# for this one project.

Norm.
google Translate;Makes my jokes fall flat- Fait mes blagues tombent à plat- Machte meine Witze verpuffen- Eh cumpari ci vo sunari
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: No functions found in a DLL

Post by Fred »

Quark wrote: Mon Dec 09, 2024 9:36 pm >Where is the DLL from? Is it 32 or 64 bit?

I think it is 32 bit but I am not sure. Does this make a difference?
It comes with TWS API installation, that is an API for interfacing with "Interactive Brokers" broker (financial info, placing orders, etc).
Yes, it does, you can't open a 32-bit dll with a 64-bit exe and vice-versa
Quark
New User
New User
Posts: 6
Joined: Sun Dec 08, 2024 4:58 pm

Re: No functions found in a DLL

Post by Quark »

> They do have a Web api which PureBasic should be able to handle easily. ( or with some effort anyway )
I have no idea of what is a Web API is. I will find out

> think about using C# for this one project.
I am a bit too old to learn a new language! I just know C and VB6 languages.
Initially I thought it was almost as simple as placing an OCX control on a VB6 form, like in the old days... :D
Normally the evolution of computer science should make things easier. This is not what seems to be happening.

> "TWSLib.dll" is a C# dll.
a "C# dll" ? What is specific about this C# DLL ? I thought DLL's were something precisely defined, all the same (standardized).

> "TWSLib64.tlb" and a "TWSLib32.tlb files:
I had already placed the files "TWSLib64.tlb" and a "TWSLib32.tlb on the same folder than the DLL and the application.

> Yes, it does, you can't open a 32-bit dll with a 64-bit exe and vice-versa
I used both PB x32 and PB x64 versions of the Compiler/debugger ==> same problem

I did not find a way to attach files in this forum. Here is a download link for the DLL, just in case anyone wants to have a look:
https://www.transfernow.net/dl/20241211 ... D/qomxs5QI
Quark
New User
New User
Posts: 6
Joined: Sun Dec 08, 2024 4:58 pm

Re: No functions found in a DLL

Post by Quark »

So nobody knows what is wrong is wrong with this DLL ?

Maybe I should find a c# compiler and try to recompile TWS.lib in a more "standard" library, if I am given this possibility.
But this way could take hours or days (or weeks, who knows...) as I never did this kind of thing.

Anyway I now took the Purebasic network functions path and this seems to work as for now (just started).

As for the web API, someone in the TWS forum seems to discourage using it. It may not be well implemented by Interactive Brokers.
Kulrom
User
User
Posts: 16
Joined: Thu Sep 07, 2023 6:07 am

Re: No functions found in a DLL

Post by Kulrom »

You can't use .net dll in PureBasic or any other programming language that doesn't run on .net .
Learn what .net is
If you're not happy with the web API, you'll have to learn at least Visual Basic.net
I love programming languages that start with the letter "P":
Python, Pascal and ... PureBasic! :)
Quark
New User
New User
Posts: 6
Joined: Sun Dec 08, 2024 4:58 pm

Re: No functions found in a DLL

Post by Quark »

> You can't use .net dll in PureBasic or any other programming language that doesn't run on .net.
OK, just to be clear: it is just not possible to use a C# or CPP compiler to generate a DLL that can be used by Purebasic. Right ?

A usable DLL could have been the simplest solution. Almost as simple as dropping an OCX control on a VB6 form, like in the simpler old days!

I am now playing with the PB network functions. I can connect and send a message successfully but dont receive any response from IBGW. I guess that IBGW does not dare responding because my ASCII command is not properly formatted.
Quin
Addict
Addict
Posts: 1131
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

Re: No functions found in a DLL

Post by Quin »

Quark wrote: Tue Dec 17, 2024 4:13 pm > You can't use .net dll in PureBasic or any other programming language that doesn't run on .net.
OK, just to be clear: it is just not possible to use a C# or CPP compiler to generate a DLL that can be used by Purebasic. Right ?
You're half correct, you can make DLLs for PureBasic using C/C++, because they compile to machine code, but not .NET. .NET DLLs are actually just assemblies, they contain IL code, which you can see by running them through any decompiler like ILSpy.
Quark
New User
New User
Posts: 6
Joined: Sun Dec 08, 2024 4:58 pm

Re: No functions found in a DLL

Post by Quark »

If I can generate a PB compatible DLL I am tempted to follow this path. Which CPP compiler would you recommend for this purpose ?
I guess that it is not possible to just open the TWS API CPP project and quickly generate a DLL ? There will probably be millions of options to select as well as many lines of code to change before that. I am usually optimistic, but these past few days, I stump on everything I try :-(
Kulrom
User
User
Posts: 16
Joined: Thu Sep 07, 2023 6:07 am

Re: No functions found in a DLL

Post by Kulrom »

Quark wrote: Tue Dec 17, 2024 5:27 pm If I can generate a PB compatible DLL I am tempted to follow this path. Which CPP compiler would you recommend for this purpose ?
I guess that it is not possible to just open the TWS API CPP project and quickly generate a DLL ? There will probably be millions of options to select as well as many lines of code to change before that. I am usually optimistic, but these past few days, I stump on everything I try :-(
Learn C# or Visual Basic .NET.
There is no other way to use .NET dlls
There is also IronPython or Python.NET. But they are so-so.
If I were you, I would choose Visual Basic .NET

The main program can be made in PureBasic. In VB .NET you can make a small CLI program that will work with your library and output the result either to a file or to stdout.
I love programming languages that start with the letter "P":
Python, Pascal and ... PureBasic! :)
Kulrom
User
User
Posts: 16
Joined: Thu Sep 07, 2023 6:07 am

Re: No functions found in a DLL

Post by Kulrom »

Try again as described in this topic
viewtopic.php?p=586522&hilit=dotnet+dll#p586522

But it is still better to use .NET programming language and Visual Studio!!!
I love programming languages that start with the letter "P":
Python, Pascal and ... PureBasic! :)
Post Reply