SUGGESTION: Enhanced external DLL support

Postby guy on Fri Jul 06, 2001 11:26 am

I've been looking into creating an external DLL that allows you to call real functions in another DLL. The original idea was to pass the name of the dll and the entry point name, then load the DLL with LoadLibrary(), look up the entry point name with GetProcAddress, transfer the remainder of the parameters to allocated memory, taking into account the data types and using the Narg parameter passed to get the count, then call the entry point through the pointer returned by GetProcAddress. The return value can then be copied back to the caller. Then free the parameter memory. I'd need to store a table of library names so that I didn't have to keep loading and freeing the library.

However, it would make much more sense if this feature was built into the PocketC compiler and runtime in a similar way to the existing external DLL interface. Either an enhancement to the #export directive or a new directive could be used.

This would mean that it would be very simple to call normal CE APIs from PocketC programs. Obviously there would be some constraints on parameters, but even those could be overcome with a suitable external definition syntax. There would also be constraints on which API calls could be made.

However, for a fairly small bit of code, this would greatly enhance PocketC's capabilities, and make it unnecessary to continually reimplement CE APIs in the shell with wrappers.

I know that this has come up before, but it appears that most of the coding needed is already in the compiler and shell.

PocketC CE API interface:
PCForm and CE API forum:
Posts: 879
Joined: Thu Dec 07, 2000 8:58 am
Location: United Kingdom

Return to PocketC for CE Suggestions

Who is online

Users browsing this forum: No registered users and 1 guest