Re: Function pointers for DLL functions?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



You could use the VARIANT type. But then, you've just made significant progress in making
a bad reimplementation of ActiveX. For what you want to do, it just screams "ActiveX"
joe

On Fri, 1 Dec 2006 12:59:53 -0600, "Peter Olcott" <NoSpam@xxxxxxxxxxxxx> wrote:


"Jonathan Wood" <jwood@xxxxxxxxxxxxxxxx> wrote in message
news:%23dk%234MXFHHA.1232@xxxxxxxxxxxxxxxxxxxxxxx
Peter,

No, DLLs do not work this way, although you could pass a pointer to a
structure or whatever, which the DLL could then access.

How would I dynamically pass parameters selected at run-time to a DLL
function using function pointers to the DLL? What is the syntax for this?
For example a user enters a number into an EditBox of a program, how do I
pass this number to the DLL using function pointers? What is the syntax for
this?

You could create a class or structure that contains the arguments. For
example, you could pass an argument count followed by a pointer to an array of
arguments. You could include additional information if argument type data was
required. It depends on what you need, but you can pass data to the DLL
function just like you'd pass it to any other function. But I would certainly
think you would need some standard structures that describe the arguments
rather than trying to passing the data directly using C++ arguments.

I want to create an interpreted language that the user can extend by adding
new functions to the interpreted language, and writing these functions in
C++. AutoCAD uses this same method to extend the capabilities of its product.
Their system is called ObjectARX. I want to duplicate this capability for my
language.

I'm not familiar with ObjectARX. COM provides a bit more functionality, if
that's what it uses. But why not just come up with a standard function
signature, something like this:

BOOL pFunction(int nNumArgs, CArg *pArgArray);

That seems to be a good idea, and the *pArgArray can point to an array of items
that can be be any type. These are created by a union, and distinguished by an
integer TypeNumber. What is the syntax for calling such a function?




And define a CArg class that contains whatever data you need. That should be
enough functionality for most operations.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com



Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • Re: Function pointers with dynamic link
    ... With dynamic link I load and use the function pointers and everything ... fine if the syntax is similar to the following ... static link, and calling the same function works fine in both modes. ... Don't pass C++ objects across DLL boundaries, ...
    (microsoft.public.vc.language)
  • Re: Function pointers for DLL functions?
    ... How would I dynamically pass parameters selected at run-time to a DLL ... What is the syntax for this? ... pass this number to the DLL using function pointers? ... And define a CArg class that contains whatever data you need. ...
    (microsoft.public.vc.mfc)
  • Re: WPS resetting like clockwork
    ... Here is an example from FreeType: ... members of a structure, containing function pointers: ... default calling convention where the caller pops the stack frame? ... big DLL, which does some initialization/finalization stuffs in DLL's ...
    (comp.os.os2.bugs)
  • Re: Java Applet Funktionalität in ASP.Net
    ... Ja indem du per Tag eine dotnet dll einbindest, ... Programmierung, also Applets, ActiveX, einschließlich javascript. ... ..NET Framework basierende Komponente" ist also keineswegs unsicherer. ... Packe dein Windows Formular in eine Windows Control Library, ...
    (microsoft.public.de.german.entwickler.dotnet.asp)
  • Re: why some dlls are scriptable and some are not?
    ... which is the same as ActiveX. ... So a COM DLL is also an ActiveX DLL. ... through its "OLE" functions to read type libraries. ... An object browser shows the methods and properties ...
    (microsoft.public.scripting.vbscript)