BBC BASIC for Windows
« Creating D3DX8BBC.DLL for BBCBASIC for Windows »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 10:49pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1 2  Notify Send Topic Print
 veryhotthread  Author  Topic: Creating D3DX8BBC.DLL for BBCBASIC for Windows  (Read 2378 times)
knudvaneeden
Developer

member is offline

Avatar




Homepage PM


Posts: 32
xx Re: Creating D3DX8BBC.DLL for BBCBASIC for Windows
« Reply #15 on: Sep 20th, 2009, 12:34pm »

on Sep 20th, 2009, 09:59am, JonR wrote:
Of course it seems that you'll have to fix the function names issue before DLL Import tool can produce sensible code.


I first tried the newest DLL importer, that correctly exported no functions names at all (because the name is thus still in C++ format). Then I tried an older version, which worked somehow, but truncated the result. But it fortunately allowed me also to suddenly see that it still was in C++ format (instead of the usual format)).

Also tried Borland impdef.exe, and Microsoft Visual Studio dumpbin.exe, but never saw the wanted output format of the function names appearing, though it shows still all that it just exports the function names at least (though in the 'strange' format thus).

I tried all kind of things (e.g. adding 'WINAPI', adding of removing 'EXPORT' versus '__declspec(dllexport)', ...
But maybe some setting later in the files overwrites somehow the initial settings, I might have to single step debug through it some time.

As a next step, I will now go carefully go through the steps in e.g. that URL tutorial and see what that gives.

Thanks,

with friendly greetings,
Knud van Eeden
User IP Logged

knudvaneeden
Developer

member is offline

Avatar




Homepage PM


Posts: 32
xx Re: Creating D3DX8BBC.DLL for BBCBASIC for Windows
« Reply #16 on: Sep 20th, 2009, 12:52pm »

on Sep 20th, 2009, 12:30pm, Michael Hutton wrote:
I *think* the problem is Visual Studio itself which, I was reading today, will decorate the function names. One of the ways around this, apparently, is to create an "export.def' file to tell the compiler the function names.


Yes, I will also try that further, did already some trials creating .def file earlier.

http://msdn.microsoft.com/en-us/library/d91k01sh(VS.80).aspx

The problem at this moment is to find out how to tell Visual Studio 2005 in the GUI settings where to find this .def file, and the format to use.

I tried earlier to put the .def file (with the same name as the project, and extension thus .def) in the same directory as the .h files to include, compiled, then checked the function names (after e.g. exchanging @6 and @8 (which should be the order numbers of that function in the DLL, that is the sixth and the eighth)). That exchanging seemed to work at the first quick glance, at least exchanging the order. But the function names were still in that C++ like format.

I will check further (also) along this path.

Thanks,

with friendly greetings,
Knud van Eeden
User IP Logged

JonR
New Member
Image


member is offline

Avatar




PM


Posts: 24
xx Re: Creating D3DX8BBC.DLL for BBCBASIC for Windows
« Reply #17 on: Sep 20th, 2009, 12:55pm »

Is your compilable source code available? Preferably the whole project.
User IP Logged

knudvaneeden
Developer

member is offline

Avatar




Homepage PM


Posts: 32
xx Re: Creating D3DX8BBC.DLL for BBCBASIC for Windows
« Reply #18 on: Sep 20th, 2009, 2:07pm »

on Sep 20th, 2009, 12:55pm, JonR wrote:
Is your compilable source code available? Preferably the whole project.


Sure, see http://www.knudvaneeden.com/tinyurl.php?urlKey=url000345

with friendly greetings,
Knud van Eeden
User IP Logged

knudvaneeden
Developer

member is offline

Avatar




Homepage PM


Posts: 32
xx Re: Creating D3DX8BBC.DLL for BBCBASIC for Windows
« Reply #19 on: Sep 20th, 2009, 3:08pm »

on Sep 20th, 2009, 12:30pm, Michael Hutton wrote:
On a related note I have now been able to create a new PerlinDLL which includes a new "GeneratePerlinTexture3d" function which will create a 2d texture based on a third (float) z parameter. Now you can scroll through 3 dimensions to create clouds etc.


Maybe create a Wiki about how you created the DLLs (generalizing, ..., simple steps 1, 2, 3, ...), so that that information is conserved and reusable for other projects? That would be great. Otherwise show it here maybe? (e.g. in a separate thread).

Thanks,

with friendly greetings,
Knud van Eeden

User IP Logged

knudvaneeden
Developer

member is offline

Avatar




Homepage PM


Posts: 32
xx Re: Creating D3DX8BBC.DLL for BBCBASIC for Windows
« Reply #20 on: Sep 20th, 2009, 10:13pm »

on Sep 20th, 2009, 3:08pm, knudvaneeden wrote:
...simple steps...


Here e.g.g about creating a simple DLL (as a spin-off of doing further testing about how to create D3DX8BBC.dll)

http://www.knudvaneeden.com/tinyurl.php?urlKey=url000350

with friendly greetings,
Knud van Eeden
User IP Logged

Michael Hutton
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 248
xx Re: Creating D3DX8BBC.DLL for BBCBASIC for Windows
« Reply #21 on: Sep 20th, 2009, 11:51pm »

Knud,

I must admit I don't really feel qualified yet. I expanded in the PerlinDLL by loading in the solution file to VC++E and then typing in a new function and adding a few lines of code which "look right". I built it and it worked, albeit resulting in a file about 7x larger! I do not think that I should be writing any "how to" guides yet!!

I will have a deeper look at the DirectDXD3 dll now I *think* I understand a little bit more about what is going on, but please don't expect anything from this end very soon.

Michael
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Creating D3DX8BBC.DLL for BBCBASIC for Windows
« Reply #22 on: Sep 21st, 2009, 11:42am »

Quote:
looking at the ASM output the code seems *very* inefficient

The key word there is "seems"; have you actually compared the timings? I don't know about Visual C, but gcc, with the maximum level of optimisation, can sometimes generate code which outperforms 'naive' hand-written assembler, the reason being that it understands the CPU's internal architecture better.

Don't be too quick to judge the code the compiler generates on the basis of what it looks like to you!

Quote:
It is interesting to see the way the compiler will translate c = (r << 16) || (g <<8) || b and compare to c = (r << 16) + (g <<8) + b

But this is a meaningless comparison. The first is using Boolean logic and the second is using arithmetic.

Surely, to make any kind of sensible comparison the first should be:

Code:
c = (r << 16) | (g <<8) | b 

that is, single | (bitwise OR) rather then double || (Boolean OR) operators. With that change I would be surprised if the code was radically different from the addition example.

If you're at a stage of learning C that you still confuse | and || you've got a very long way to go!

Richard.
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Creating D3DX8BBC.DLL for BBCBASIC for Windows
« Reply #23 on: Nov 30th, 2009, 08:25am »

If you want something doing, do it yourself! I installed Visual Studio 2008 Express on my Vista machine and, despite never having used it before, within a few hours I'd successfully built a complete D3DX8BBC.DLL. I was surprised how easy it was, especially considering some of the earlier comments made in this thread. I had no problems with 'name decoration', and did not need to create a .def file.

One thing I made a particular point of doing was to keep the source file as d3dx8bbc.c rather than renaming it as .cpp so whether that helped I don't know.

I've uploaded the hopefully functional, but largely untested, version of D3DX8BBC.DLL here:

http://groups.yahoo.com/group/bb4w/files/Libraries/D3DX8BBC.dll

This exports 199 functions in total, including those implemented in C++ (which were the ones I couldn't incorporate using GCC). It should be functionally equivalent to Microsoft's D3DX8D.DLL but is slightly smaller (not being a Debug version) and - most importantly - should be entirely legitimate to distribute.

It has had virtually no testing, so I would welcome reports of any problems such as missing functions or incorrect behaviour.

Richard.
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Creating D3DX8BBC.DLL for BBCBASIC for Windows
« Reply #24 on: Dec 1st, 2009, 10:05pm »

As a test of the DLL I've written this program:

http://groups.yahoo.com/group/bb4w/files/Graphics/tumblingteapot.bbc

It requires the DLL to have been downloaded to your LIB folder:

http://groups.yahoo.com/group/bb4w/files/Libraries/D3DX8BBC.dll

Those 3D graphics enthusiasts who have been stymied by the absence of D3DX support (at least, 'legal' D3DX support) can now make progress.

Richard.
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Creating D3DX8BBC.DLL for BBCBASIC for Windows
« Reply #25 on: Dec 4th, 2009, 5:21pm »

D3DX8BBC.DLL has a dependency on the C run-time library MSVCR90.DLL. Unfortunately, unlike MSVCRT.DLL (which is present on every Windows system from Win98 onwards), some PCs appear not to have MSVCR90.DLL installed.

Therefore I've uploaded a new version of D3DX8BBC.DLL without the dependency (although it increases the file size somewhat):

http://groups.yahoo.com/group/bb4w/files/Libraries/D3DX8BBC.dll

I've also updated the Tumbling Teapot executable to use this new version:

http://groups.yahoo.com/group/bb4w/files/Graphics/tumblingteapot.exe

Richard.
User IP Logged

Michael Hutton
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 248
xx Re: Creating D3DX8BBC.DLL for BBCBASIC for Windows
« Reply #26 on: Jan 13th, 2010, 11:52am »

Quote:
It has had virtually no testing, so I would welcome reports of any problems such as missing functions or incorrect behaviour.


I couldn't seem to find the D3DXCreateText function in the dll. Is this only with the DirectX9 version ? (I am currently downloading the "old" DirectX8 SDK to check).

Michael
User IP Logged

Michael Hutton
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 248
xx Re: Creating D3DX8BBC.DLL for BBCBASIC for Windows
« Reply #27 on: Jan 13th, 2010, 12:22pm »

Doh. They are there as

D3DXCreateTextA - ANSI version

and
D3DXCreateTextW - UNICODE version

Should have thought of that before..

Michael
User IP Logged

Michael Hutton
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 248
xx Re: Creating D3DX8BBC.DLL for BBCBASIC for Windows
« Reply #28 on: Jan 28th, 2010, 12:40pm »

I noticed that

For the first step you would need to take the existing source file: http://groups.yahoo.com/group/bb4w/files/%22Temp%20Folder%22/d3dx8bbc.c

is missing from the temp folder... Can we have it back?!

Michael
User IP Logged

Pages: 1 2  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls