To: mert0407 AT sable DOT ox DOT ac DOT uk Date: Mon, 21 Sep 1998 02:11:59 -0700 From: "Doug Gale" Message-ID: Mime-Version: 1.0 Cc: djgpp AT delorie DOT com Subject: Re: DJGPP and windows? Organization: MailExcite (http://www.mailexcite.com:80) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Precedence: bulk -- On Sun, 20 Sep 1998 15:20:00 George Foot wrote: >On 20 Sep 98 at 7:41, Doug Gale wrote: > >> I realize that rsxntdj is harder to install than djgpp, and that is the reason for it's >> bad reputation, but look at how many people have problems with djgpp installation. >> >> I would like to be able to make a new patch file for the headers as I have eliminated >> some warnings in the headers. Can anyone suggest a good text-based patching program >> (for creating 'diffs')? > >GNU diff? :) Get dif*b.zip and pat*b.zip from the v2gnu >directory. It's what is used for sending patches to the djgpp >sources, and it is how Allegro WIPs are distributed (as patches >against the main distributed source code). It's very easy to >use, if you read the Info documentation. In brief, you'd >probably say: > > diff -c file.old file.new > output.diff > >Then: > > patch < output.diff > >Easy. If you're making changes to a lot of files it's more >normal to run a recursive diff from the base of the directory >tree, and then the patches to all the files will be in one text >file, and can be applied in a single command. Feel free to ask >if you need any more suggestions about this. > Perfect. That's just what I needed to know. >> Is anyone out there maintaining rsxntdj? I have a modified specs file with a major fix >> in the linking part. This oversight in the rsxntdj distribution caused even the >> hello-world example to have linker errors. I would like to redistribute a new specs >> file and patch for the headers. Any objections? > >I don't know, I hope someone is -- from what I've seen so far >(1 day) it's very powerful. > >I installed it yesterday, along with WinAllegro, which I ported >to `work' with RSXNTDJ. Unfortunately there are a few slight >problems which I hope you wouldn't mind helping me with. > >WinAllegro is based around a DLL made with MSVC. So far nobody >(apart from me) has ported it to anything other than MSVC, but >the author tells me that it should be possible. To port it I >needed to make an import library for the DLL and adapt the >header files to be readable by djgpp/RSX -- not hard, since >they were originally djgpp-only anyway. > >The problem is with variables in the DLL, which need to be >accessed from user programs. The author of WinAllegro tells me >that MSVC has a special way to declare such variables -- in the >DLL you declare them with "__declspec(dllexport)" and in the >user program's header file you declare with >"__declspec(dllimport)". RSXNTDJ doesn't choke on this, but >it's not documented. I was wondering about that (__declspec(dllimport) I mean) and remember seeing a #define in one of the headers (wingnuc.h I think) that translates it to nothing. > >Instead I tried to use the system described in RSXNTDJ's >documentation. The actual problem I have is with the `screen' >variable, but I'll use a simpler (made up) variable to describe >the problem. > >Suppose the DLL contains a variable: > > int foo; > >At the top of the header file I'm using to link with the DLL >import library I put: > > #define foo (*foo) > >as suggested in RSXNTDJ's docs. However, it doesn't work. > >Specifically, in a program linked with this import library I >can #undef foo, then confirm that `foo' (which is now of >type int *) is not NULL. However, I can't access the >location it points to. Surely this should have been arranged What exactly do you mean by "can't access the location it points to". Do you get a GPF or page fault or something? >when the DLL was loaded (because `foo' should point to the >real variable in the DLL), which is transparent to me isn't it? Yes, AFAIK that is how it is supposed to work. >I've tried to follow the example set by the loadtime.c file in >samples/dll/rtdll. Could the problem be that MSVC created the >DLL using the __declspec(dllexport) tag? > Not sure. I've never needed to access a DLL variable. I have a suggestion though. In windows explorer, right-click the exe of your program and choose Quick View (you may need to install Quick View if it's not an option). Scroll down a bit, and view the import table. You can see if that variable is indeed being imported. Another idea would be to make a DLL as described in the RSXNTDJ help with a variable in it. Then link to that DLL and see if you can access the variable the same way. >I really don't know much about DLLs, so please excuse my >ignorance. All the functions in the DLL work perfectly. Of >course that's an exaggeration! I've called about twenty of >them, which work fine. > >Incidentally I didn't install RSXNTDJ according to the >instructions -- not exactly, anyway. I strongly disagree with >using it on top of djgpp, because it uses its own library; it >really shouldn't be using any of djgpp's headers. I made a new >djgpp installation, without the main library, and installed >RSXNTDJ there in situ, i.e. so that its `bin' directory >coincided with the new djgpp installation's `bin' directory. > I agree 100%. I would even go as far as to say you MUST NOT install rsxntdj on top of djgpp. I recommend putting it beside djgpp (example: if you use c:\djgpp, install rsxntdj in c:\rsxntdj) I actually have rsxntdj installed on a different drive from djgpp (not because I needed to though) and have had no problem with that. >This also means that when I use normal djgpp I don't have to >use RSXNTDJ's linker, and I have found that it generally makes >the installation and configuration very smooth indeed. I have >a batch file to switch between the two (actually, I also have >djgpp v2.02 installed in a similar fashion, so I can switch to >that with the batch file too). > I have created similar batchfiles to redefine my DJGPP environment variable and swap linkers. >I really don't think that my wandering from the installation >instructions can have caused this problem, because everything >else works fine -- all the sample programs, including the DLL I agree, if you can import functions, why not variables. Right? >ones. I mentioned it anyway, partly because you might like to >do the same, and partly in case it can have caused the problem. > >I described my installation procedure on the Allegro mailing >list yesterday; I can send you a copy if you need to see it. > >Thank you for persuading me to try out RSXNTDJ (indirectly). >It was your emails to the djgpp list that informed me that it >really does work. RSXNTDJ does have a bad name IMHO; people >try it, can't make it work, then tell other people that it >doesn't work... and other people wander around saying that >it's not sufficient to write proper Windows programs, when >they probably haven't even tried it. The license agreement >is slightly restrictive, but since I don't plan to sell my >software anyway it doesn't matter. > The licence agreement is questionable. It says send money to the author, but I have been unable to locate him and the supplied email address doesn't work. I find the requested commercial licencing fee very reasonable ($40) considering how much work it must have been to get import libraries and building dlls working. >Thanks in advance for any assistance you can give. > >-- >george DOT foot AT merton DOT oxford DOT ac DOT uk > Free web-based email, Forever, From anywhere! http://www.mailexcite.com