home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!spool.mu.edu!agate!plutonium.CChem.Berkeley.EDU!matte
- From: matte@plutonium.CChem.Berkeley.EDU (Matt Rose)
- Newsgroups: comp.lang.pascal
- Subject: Calling DLL Procs via pointer.
- Date: 23 Dec 1992 00:58:02 GMT
- Organization: University of California, Berkeley
- Lines: 41
- Distribution: usa
- Message-ID: <1h8diqINN64q@agate.berkeley.edu>
- NNTP-Posting-Host: plutonium.cchem.berkeley.edu
- Keywords: Pascal DLL Assembly
-
-
- I've been using MS-Windows for awhile now, via BC++, and BP, and
- I'm getting used to it, and even liking it sometimes. But I seem
- to have come across what I would consider a shortcoming of Pascal.
-
- I want an Object that will call procedures from a DLL that is specified
- during run time. The code in C would look something like this:
-
- hLibrary = LoadLibrary('Library_Name');
- pDLLFunc = GetProcAddress(hLibrary, 'FuncName');
-
- Then later on I excecute by calling:
-
- (*pDLLFunc)(paramList);
-
- Borland C requires type checking on the parameter list that is achieved
- by forcing you to declare a pointer to function that returns TYPE, and
- takes paramters of TYPE and TYPE. The strict type checking follows in
- the way of Pascal.
-
- Except that the BP manuals tell me there is no provision for making a
- call to a procedure that I have a pointer to. It appears that I have
- to go to assembly language! If this is the case I can do it, but I
- have to spend my valuble (ha ha) time learning assembly, and how to pop
- and push stacks and the like. Geez, I'm an engineer not a programmer! :)
-
- I find the LoadLibrary very useful for defining drivers and the like
- for equipment, and not forcing me to decide on the equipment until I'm
- running the programs.
-
- Questions:
- Why does Borland Pascal not include a provision for making a function call
- from a pointer to the function?
- When will they provide this feature?
- Is there any other way I can call procedures from a library that won't
- be written until after the main program is finished?
- Has anyone coded an object in C, and then declared an instance of said
- Almost liking MS Windows, despite my dislike for a man who would make
- $Billions off DOS.
-
- -matt
-