Author Topic: New WinLibrary  (Read 4881 times)

0 Members and 1 Guest are viewing this topic.

Peter

  • Guest
New WinLibrary
« on: June 03, 2012, 07:58:47 AM »
Deleted
« Last Edit: April 26, 2015, 06:42:00 AM by Peter »

Aurel

  • Guest
Re: New WinLibrary
« Reply #1 on: June 03, 2012, 08:58:51 AM »
Peter...
I don't know what you do this time but looks that work
not very well...
First example work to slow...
Second 'Fly Away' - only black window ..?
As i see you replace old way in .inc with call .

Aurel

  • Guest
Re: New WinLibrary
« Reply #2 on: June 03, 2012, 11:39:43 AM »
Peter
it looks that tree example with blinking-tree work ok but shooter work to to slow.
Comparing to old uffo2 who run on speed of light.
dam... just when i tough to spend some time on uffo game again something do not work >:(

Aurel

  • Guest
Re: New WinLibrary
« Reply #3 on: June 03, 2012, 11:47:38 AM »
Uff..
maybe is problem with gremlins work again....
where is my rubber hamer...

ok,i will try on my second computer then i will see... ;)

kryton9

  • Guest
Re: New WinLibrary
« Reply #4 on: June 03, 2012, 12:58:43 PM »
Try this Aurel, Peter has very bad organization and makes it very hard to run his stuff.

Also I noticed in both of your nice header files you use LoadLibrary , but you have to call FreeLibrary when finished with it and you guys don't.

Aurel

  • Guest
Re: New WinLibrary
« Reply #5 on: June 03, 2012, 01:37:55 PM »
Hi Kent...
You mean on this:
Code: [Select]
Dim kernel32,user32,gdi32,riched32,comdialog32
kernel32 = LoadLibrary "kernel32.dll"
user32   = LoadLibrary "user32.dll"
gdi32    = LoadLibrary "gdi32.dll"
riched32 =  LoadLibrary "riched32.dll"

Those are system libs and i think that is released by system.
Infact you may see that api call LoadLibrary is not even declared,right?
By logical way,you are right,but i don't see any problem with that,but maybe im wrong.
For example in EB when i use scintilla.dll i use FreeLibrary to relase scintilla.
Ok i will try... ;)

kryton9

  • Guest
Re: New WinLibrary
« Reply #6 on: June 03, 2012, 01:54:35 PM »
Look at Charle's MinWin.inc. He has a subroutine to free the libaries when the program using the MinWin.inc is finished.

I am working on my own header file now too, but I will not use Loadlibrary to not worry about freeing the libraries later.

Aurel

  • Guest
Re: New WinLibrary
« Reply #7 on: June 03, 2012, 02:35:37 PM »
Quote
I am working on my own header file now too, but I will not use Loadlibrary to not worry about freeing the libraries later.

I am not sure why is used this way with LoadLibrary in first place ,and Charles probably
know the answer...
Anyway we will see what be your way i hope...
I will guess ...OOP way of class ,right?

kryton9

  • Guest
Re: New WinLibrary
« Reply #8 on: June 03, 2012, 03:49:06 PM »
We'll have to say what Charles says about if you have to freelibrary or not when you use loadlibrary.
I just saw that he was freeing in his header file and you and Peter weren't in yours.

Charles Pegge

  • Guest
Re: New WinLibrary
« Reply #9 on: June 03, 2012, 05:04:13 PM »
You only need to free the libraries which you have explicitly loaded with Loadlibrary. If they are the major Windows libraries like kernel32.dll then freeing them is not important since they are permanently resident as part of the OS. I do it out of politeness to the system :)


Charles

Charles Pegge

  • Guest
Re: New WinLibrary
« Reply #10 on: June 03, 2012, 06:57:24 PM »
Peter,

If you like prototypeless procedures, this is very efficient, because all the proc-names are processed in one block, and you can get a list of errors.

Code: OxygenBasic
  1.  
  2. kernel= LoadLibrary "kernel32.dll"
  3. bind kernel
  4. (
  5. GetModuleHandle GetModuleHandleA
  6. ExitProcess ExitProcess
  7. GetCommandLine GetCommandLineA
  8. )
  9.  
  10. er=error
  11. if er then print er 'check for list procname errors
  12.  
  13. a=GetCommandLine
  14. print as char* a
  15. '..
  16. freelibrary kernel
  17.  

Charles
« Last Edit: June 03, 2012, 07:03:29 PM by Charles Pegge »

kryton9

  • Guest
Re: New WinLibrary
« Reply #11 on: June 03, 2012, 08:18:19 PM »
Can you just load a whole library and not select the functions you want, just take them all?

kernel= LoadLibrary "kernel32.dll" 
bind kernel 

     rem you get everything in kernel32.dll
)

Charles Pegge

  • Guest
Re: New WinLibrary
« Reply #12 on: June 04, 2012, 01:46:06 AM »

Could do so by hacking into the DLL's export table and extracting all the names first. Logistically it would not be of much benefit - you would still need to know what params are required by each procedure, and what they are used for.

Charles Pegge

  • Guest
Re: New WinLibrary
« Reply #13 on: June 04, 2012, 04:45:44 AM »
The libraries are all freed by the C runtime before the program terminates. Oxygen does this for all libraries referenced in declare statements but not with bind statements.

Charles Pegge

  • Guest
Re: New WinLibrary
« Reply #14 on: June 04, 2012, 06:14:44 AM »

 One of the parameters: IDirectDrawSurface7. As far as I can tell., this is only available from a COM interface. Different ball game!

http://msdn.microsoft.com/en-us/library/windows/desktop/gg426178(v=vs.85).aspx