From: Jared S. <Jar...@li...> - 2000-09-27 04:19:36
|
Is there a way to get something like a 'Ctrl - Alt - Enter' combo past the allegro keyboard handler and to the OS, without shutting down the handler? = (Linux version of allegro) Thanks, Jared Jar...@li... >From <all...@ca...> Wed Sep 27 05:07:00 2000 Received: from finch-post-11.mail.demon.net [194.217.242.39] by canvaslink.com with ESMTP (SMTPD32-6.00) id A8B31D5501CE; Wed, 27 Sep 2000 05:06:59 -0400 Received: from lwithers.demon.co.uk ([194.222.80.1]) by finch-post-11.mail.demon.net with esmtp (Exim 2.12 #1) id 13eDAz-0000V7-0B for al...@ca...; Wed, 27 Sep 2000 09:06:54 +0000 Message-ID: <oOr...@lw...> Date: Tue, 26 Sep 2000 08:48:17 +0100 To: al...@ca... From: Laurence Withers <lwi...@lw...> References: <32F...@ww...> In-Reply-To: <32F...@ww...> MIME-Version: 1.0 X-Mailer: Turnpike Integrated Version 5.01 M <WCcCG$mmNL32sYSf46vBeC80CR> Subject: Re: [AL] Lock functions and variables in classes Precedence: bulk Sender: all...@ca... Reply-To: al...@ca... X-UIDL: 268079491 Status: O Content-Length: 2794 Lines: 70 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 In reply to Czamai, Martin (Czamai, Martin <M.C...@pe...>): >my problem is, that I want to lock functions like a interrupt service >routine for some piece of hardware in the constructor of my class MyClass. >This doesn't work since MyClass::MyMethod_end is no member of MyClass, >which is generated by the LOCK_FUNCTION macro. >Any idea how I can fix this problem?? >Thanks in advance OK, this is quite a difficult problem to solve. Basically, Allegro locks functions by using a dummy function, declared after the function to lock, to get its end address. When you write: void my_function() { /* some stuff here */ } END_OF_FUNCTION(my_function); Allegro creates a dummy function, perhaps my_function_end or something, directly after your function. We now assume that when your compiled executable is loaded into memory, my_function_end is located directly after my_function. To lock the memory used by my_function, Allegro needs to know its start location (simple; that is just &my_function), and its length. Computing the length of the function requires another symbol directly after my_function, so the length can be found as (&my_function_end - &my_function). Now we can lock that function (hopefully!) In a C++ class, however, we have a slightly more complex problem: name mangling. For instance, your method's actual function name might well be `pXkqMyClass_MyMethod' - the C++ compiler mangles the name so that it can support function overloading (the weird characters at the beginning would indicate the argument types). So, your only option is to somehow find the mangled name, and write END_OF_FUNCTION(mangled_function_name) after your function definition. Of course, this might not work :-) You also have one more problem - if you are constructing an object in an interrupt context, you are allocating memory, which is a call to a standard library routine. You are not allowed to do that in an interrupt context. To be honest with you, I would use the placement new operator and write your own constructor and object factory in C. You would have to allocate memory in advance of the interrupt and lock it. During the interrupt, you would have to use placement new to create a new object at that location. The operator does not allocate new memory or call the object's constructor, so you have to construct the object yourself. Probably your best bet is to think of another way of doing what you want to do. Bye for now, - -- Laurence Withers, lwi...@lw... http://www.lwithers.demon.co.uk/ -----BEGIN PGP SIGNATURE----- Version: PGPsdk version 1.7.1 iQA/AwUBOdBUwXcA2AQvE3AZEQI5DQCgqystMfTgwzHEMVHTexuIRNG7HJQAoJW5 iMtwJoNWExfHsFSz5yV9PLKh =C2Hp -----END PGP SIGNATURE----- >From <all...@ca...> Wed Sep 27 07:45:12 2000 Received: from mail5.svr.pol.co.uk [195.92.193.20] by canvaslink.com with ESMTP (SMTPD32-6.00) id ADC81D670162; Wed, 27 Sep 2000 07:45:12 -0400 Received: from modem-213.phosphorus.dialup.pol.co.uk ([62.136.14.213] helo=ollie) by mail5.svr.pol.co.uk with esmtp (Exim 3.13 #0) id 13eFe6-0003uD-00 for al...@ca...; Wed, 27 Sep 2000 12:45:06 +0100 Message-ID: <002001c02878$074f54c0$d50e883e@ollie> From: "Ollie" <odo...@x-...> To: <al...@ca...> References: <000001c0281b$62fab740$0101bfbf@f9c6f0> Date: Wed, 27 Sep 2000 12:42:32 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Subject: Re: [AL] Allegro 3933 with msvc :) Precedence: bulk Sender: all...@ca... Reply-To: al...@ca... X-UIDL: 268079491 Status: O Content-Length: 436 Lines: 14 > 2) for the direct x SDK, the doc could state that only the lib & header > file ( dx7libhdr.exe 1.3MB ) is needed and not the whole SDK ( 120 MB !? ) Hello Matt, do you already have the complete SDK? if so, have a look at this to help get set up: http://members.nbci.com/_XMCM/LouisHowe/allmsvc.htm it's true as far as i know though, you dont need the complete SDK, it all depends on what you are planning to do i guess. Ollie |