hello guys, I would like to let you know that it would be interesting to import DLLs with classes in C++
this would make it easier to create wrappers and features for PB, an example of libraries with classes is the SteamWorks library ( steampowered.com )
Import c++ DLL with classes
- skinkairewalker
- Enthusiast
- Posts: 637
- Joined: Fri Dec 04, 2015 9:26 pm
Re: Import c++ DLL with classes
Code: Select all
#steam = 1
res = OpenLibrary(#steam, ".\steamworks_sdk_151\sdk\redistributable_bin\win64\steam_api64.dll")
Debug res
Belive!
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
Re: Import c++ DLL with classes
not helpful.
Anyway, won't happen c++ class style
This might help: "Flat interface for binding to other languages
The SDK has a few features to facilitate the creation of binding layers for other languages.
steam_api_flat.h declares a set of "flat" functions that mirror the interface functions in the SDK. This is not pure C code, but it does use plain C linkage and calling conventions, so it is easy to interop with other languages. These functions are exported by steam_api[64][.dll/.so/dylib]."
https://partner.steamgames.com/doc/sdk/api#thirdparty
Anyway, won't happen c++ class style
This might help: "Flat interface for binding to other languages
The SDK has a few features to facilitate the creation of binding layers for other languages.
steam_api_flat.h declares a set of "flat" functions that mirror the interface functions in the SDK. This is not pure C code, but it does use plain C linkage and calling conventions, so it is easy to interop with other languages. These functions are exported by steam_api[64][.dll/.so/dylib]."
https://partner.steamgames.com/doc/sdk/api#thirdparty
Re: Import c++ DLL with classes
The upcoming PureBasic Version 6 should make this a lot different and easier.
Re: Import c++ DLL with classes
It won't. C++ is known to be hard to link to from other languages, as is any other more complex language that supports OOP because they all do it in different ways. You always need a flat C "proxy" created in C++ that interfaces with the C++ code. Or a standard like COM on Windows... Weird there is no universal low level inter language communication standard. A thing we may hope for is direct import of C headers in PB, but even that I question since it seems they want to keep it feature-wise a copy of the asm backend and PB does not have all exact C data types (signed/unsigned). Hope the C backend brings language enhancements that obviously break comparability with the asm backend because nothing happens on that side. Just leave it in as classic mode and use the opportunity to make some needed language improvements. Just my 2 guilders.