May 28, 2023, 03:29:40 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


need help getting dll to work

Started by RG, November 16, 2009, 01:47:33 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

RG

I have an ebasic program that uses 3D commands. It was compiled as a project. When I compile it and run the .exe using the same computer it was compiled on, it works. If I try to run it on a computer without ebasic on it, it crashes with an error caused by dx3dr9.dll. The dll is in the same directory as the exe on the second computer. Some other facts:

1. The crash occurs on both an XP and a Vista computer.
2. The error report calls out the dx3dr9.dll as the problem. The information in the report for that dll shows all zero's.
3. Based on what windows have opened, it appears to be crashing on the first 3D command.
4. If I try the same with a single-file exe (tested with two of the 3D examples provided with ebasic), they run fine on the second computer.
5. If I change the name of the dll, the two single-file exe's report the dll is missing. The project-based exe also reports the dll is missing.
6. I also tried by including the dx3dr9.lib in the project as discussed in help ("Adding other external library/object files.A project may contain external object or library files.  These can be specified in the source code with the $USE statement or added to the project by following these steps. 1. With a project open select the Project menu of the IDE and choose Insert Library/Object into Project. 2. Select one or more library or object files to insert from the file dialog and press "Open". The added files will be listed in the File View of the IDE after all of the source files. For a static library project the external object files must be in the same directory as the project output. For other project types the external library/object can be located anywhere on the drive." No change  - still crashes.

Any ideas on what's happening and how to fix?

Thanks, Rich

Ionic Wind Support Team

Rich,
Not without seeing any source code.  I have no problems using projects with the 3D commands.  And you shouldn't be including the .lib with the project or in a $use statement, since it is automatically included as the 3D commands are part of the base language. If you can build the .exe then it has nothing to do with the .lib

I could venture a guess that your not using project global variables correctly, which would explain why it works in a single file.

Someone else just ran into that issue with a simple dialog:

http://www.ionicwind.com/forums/index.php/topic,3741.0.html

The DLL does have the requirements of DirectX 9.0c or greater installed, perhaps the second computer isn't meeting those requirements? 

Paul.

Ionic Wind Support Team

RG

Paul,

I'll check the global variables. But I'm running the program fine built from a project on the computer with ebasic installed. It's only on a computer without ebasic that I'm having problems running the exe. I was getting ready to beta-test with other users and since they won't have ebasic, that why I was testing it on other computers.

The two other computers I tested have DirectX 9.0c and run two of the 3D examples that come with ebasic without any problem. Both are compiled from a single file, which is why I was thinking there might be a difference caused by the project.

I haven't needed to use the lib or $use statement to run on my development computer. I only tried those to see if that would help resolve the problem on the other computers.

I guess I'll combine all the files into one and see if that is transportable.

Thanks, Rich

Ionic Wind Support Team

There really is no difference in the executable when you are using projects or a single file.  So it is something structured in your project wrong.

Emergence doesn't install anything special for the 3D commands, just the DLL in your system directory and in the redistributable directory.  The DLL also works fine with Aurora project created executables on many machines, including my lowly XP netbook which doesn't have Aurora or Emergence installed on it.

Paul.
Ionic Wind Support Team

RG

Thanks for guidance. I'll have to start taking code out until I get something running on the other computer. Will be slow going as I have to transfer it to a USB stick and move it each change.

Rich

RG

Good news - I tracked it down to one line in almost 5000 lines of code. Paul was right, it had nothing to do with the dll or a project, but as it dealt with a 3D call, it caused the crash to be reported as being from the dll. Removing the one line corrected the problem and the program works on all computers.

In case others experience the same, the problem was a line in the handler for the windowed 3D screen. I coded it so that when the program's windows are resized, the 3D screen is reset to match the new size. There was a line added to force a call to the drawing routines which update a 2D and a 3D screen. This must be getting called upon window creation which occurs before I setup the 3D scene, camera and lights. So it should fail. The puzzle I still have is why it worked at all on my developmental computer where there is no crash with or without the offending line. Glad I tested it on other computers before I gave it to others for testing.

sub main3d
def l,t,w,h:INT   
select @class 
   case @idsizechanged
      getsize screen.m_win,l,t,w,h
      screen.Reset(w,h,0,0)
'               the following line is the problem line;
'      drawoutline(front,0)
endselect
return
endsub

Thanks again to Paul for his help.

Rich