Re-exporting functions from dynamically linked DLL

Hi,

I have the following situation:

I have a 3rd party DLL which does not include a LIB file, just a header file
with typedef declarations for exported functions (It is intended for dynamic
linking)

I need to wrap the DLL to allow for callbacks to my own code (in Lisp), and
to do this I need to load the DLL using LoadLibrary and access each function
that I need using GetProcAddress.
So for example:

The third party header will say:
typedef INT  (WINAPI * lp_function)();

Then in my c wrapper file:
#include "3rdparty.h"

#ifdef _WIN32
#define DllExport __declspec(dllexport)
#else
#define DllExport
#endif

HINSTANCE hInstance;
lp_function f1;

DllExport int initialiseAPI()
{
  if(NULL==(hInstance=LoadLibrary("demoapi.dll")))
 {
  return 1;
 }

 if(NULL==(f1=(lp_function)GetProcAddress(hInstance,"function")))
 {
  return 1;
 }

}

etc.

The I implement the callback code which in turn calls code on my Lisp side.

So my question is:
I want to re-export these dynamically linked functions.   I could easily
wrap them:

DllExport void wrappedf1 (int arg)
{
 f1(arg);
}

but I would prefer to just declare it as exported somehow.   If I try
something like changing their header file to say:
typedef DllExport INT  (WINAPI * lp_function)();

and my code to declare:
DllExport lp_function f1;

I get a Segmentation Violation.

Anyone have any ideas?


0
4/25/2005 11:39:30 AM
vc.mfc 33608 articles. 0 followers. Follow

0 Replies
455 Views

Similar Articles

[PageSpeed] 20

Reply:

Similar Artilces:

Testing a range of cells in an IF FUNCTION
Trying to test a range of cells in an IF Function. I would like the function to look at 15 cells in a single row, find a value within those cells, and then return another value if TRUE/FALSE. As of now, I can only apply the "logical test" in the IF formula for ONE CELL ONLY. I would like it to test a RANGE of cells in one row, find if any of the values match my logical test, and then return a value. Anyone understand or know how to do this? I tried apply "lookup" function, but I don't think it will work Please help Aaro aaronplange at hotmail.com Hi maybe someth...

CRM 3.0
Hi All, I am writing a custom report for CRM 3.0 to basically copy the My Activities view but display the regarding and To contacts and associated phone numbers. The report is basically done except for a few small issues. I would like to set up the Dynamic Drill-Through so when the person clicks on the Activity Subject it will open the associated Activity record. Unfortunately I have been unable to find the information needed to use in the following code to set the Object Type Code (OTC) to the correct activity type: = Parameters!CRM_URL.Value & "?ID={"&Fields!Activityid...

Export of a Hotmail folder
Can I export a folder of mail from my web-based Hotmail to another e-mail address of mine which is linked to Outlook Express? "hyho" <hyho@discussions.microsoft.com> wrote in message news:64F11AE6-E2EC-40A8-BCFB-A9DE691B084C@microsoft.com... > Can I export a folder of mail from my web-based Hotmail to another e-mail > address of mine which is linked to Outlook Express? How does this relate to Outlook? -- Brian Tillman [MVP-Outlook] ...

Autofill In Linked Forms
I have created a couple of forms by selecting all the fileds in the form wizard from two tables: 1. Suppliers (Fields: Supplier, Address, Contact, etc.) 2. Products (Fields: Supplier <Lookedup from Supplier Table>, Product, Rate, etc.) Upon clicking the toggle button on Suppliers form I have the Products form opened. However, as I enter the data in it, I want the Supplier filed in the same be automatically be filled with the Supplier name as in the opened Supplier form so as to be filtered and displayed the next time I open the same instead of manually inserting the sa...

re:Restart remote computer
Try "%windir%\system32\shutdown.exe -r -t 00" (without the Quotes)i"ve never tried it on a remote> but it triggers an immediate reboot on my box... In news:27t1861l837f5cpt7ekpnmj9ogh7bea3dv@4ax.com trashcan@xrex.us wrote: > > Try "%windir%\system32\shutdown.exe -r -t 00" (without the Quotes)i"ve > never tried it on a remote> but it triggers an immediate reboot on my > box... To reboot a remote machine you need to supply the remote hosts's name: shutdown -r -m \\hostname But then you run into user permissions on both th...

RE: Use that security update
--dedtgpho Content-Type: multipart/related; boundary="yzkfzsfqtv"; type="multipart/alternative" --yzkfzsfqtv Content-Type: multipart/alternative; boundary="qeviqcxczwaquy" --qeviqcxczwaquy Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Microsoft Consumer this is the latest version of security update, the "October 2003, Cumulative Patch" update which eliminates all known security vulnerabilities affecting MS Internet Explorer, MS Outlook and MS Outlook Express as well as three newly discovered vulnerabilities. Install now to hel...

Import/export custom attributes
I have something that is driving me nuts. I need to import a custom attribute for 600 plus users and then also modify these from time to time. Right now I just need to do the bulk import. I have the user names in a spreadsheet with this ID and it is unique to the user. I need to import that into the AD for everyone. I have looked everywhere and can't figure out how to do it. I am USELESS at scripting with VB, and I tried running some csvde queries but not much luck. can someone help?? thanks!! ...

Export query to Excel with formated heading
When export from query to Excel, I'd like to turn some columns into heading row on top of Excel sheets how to turn this: LastName FirstName SID Section Instructor Doe John 1234 0545 Su Doe Jane 2345 0545 Su into this? Class Roster Instructor: Su Section: 0545 LastName FirstName SID Doe John 1234 Doe Jane 2345 I think one way of achieving this would be to create a report in Access where you would group under instructor with the students in the detail section. From the report you can then use the analyze with Ex...

Re: Function to copy data from a variable range?
I have a sheet with about 20,000 lines of data. From that sheet I am looking to group the data based on a parameter, into multiple different sheets. ie: If the category is "1" copy all that lines data into sheet A, If the category is "2", copy all the lines into sheet B. The problem is, the number of lines for each acatgeory type is not always the same. Some categories may only have 1 or two lines, other may have 200-300. Is there any type of function for this? Thanks! Doable but why not just use data>filter>autofilter -- Don Guillett Microsoft MVP Excel SalesA...

Changing source links in powerpoint
I currently have a powerpoint with source links to other powerpoint slides. These source links are currently internet address based links. I'm trying to change these current internet addresses to new internet addresses and each time I try I receive the error message: "You cannot use an internet address here. Enter a path that points to a location on your computer or on the network". I've been able to change the source links in the past and only began to encounter this problem around mid December. Does anyone know how to correct this or explain why I can no ...

For Russ Paul-Jones of Microsoft re the News Headlines
Russ, it has been several days since your post re Microsoft working on the problem regarding the news headlines on MS Money not opening, and they still don't open. Just wanted to let you know... Thanks. Getting back after the long weekend, it looks like it is working now, at least in Money 2006. Still having trouble? -- Russ Paul-Jones russpj@microsoft.com MS Money Product Unit Manager "Chuck" <chleven@msn.com> wrote in message news:OLEfXCJ8FHA.4084@TK2MSFTNGP10.phx.gbl... > Russ, it has been several days since your post re Microsoft working on the > pro...

By: deesom In: microsoft.public.dynamics.gp.developer
I do have an unusual situation - and I really do need your help, urgently: I have a gravel road infrasture asset (GRDS-0001 with suffix 1). It has a Net Book Value of $ 1,200,000. This gravel road was paved over at a cost of $ 750,000. The asset is no longer a gravel road, and the transformed asset needs to be classified as a new asset, for example , with an asset ID of PRDS-0001(suffix 1). How would I properly create and record this new asset, with the cost of $ 1,950,000, and still preserve the history of the old asset (GRDS-0001), that no longer exists. I did not feel comfortable ...

change exist chart to be dynamic
Hi all How can I change an existing chart to be dynamic? In series I saw a name in y axis only but no name of x axis. How can I create a series for x axis? Thanks in advance Daniel You need to understand how dynamic charts work. There are tutorials and links to more on this page: http://peltiertech.com/Excel/Charts/Dynamics.html - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Daniel" <Daniel@discussions.microsoft.com> wrote in message news:FF77A61A-58A9-4629-90E1-20742E6...

Should unimplmented pure function throw a compile error?
It's been a while since I have written anything with abstract classes. If I derive a class from my abstract class and do not implement a pure virtual function of the base class in the derived class, shouldn't the compiler throw an error? -- Bruce E. Stemplewski GarXface OCX and C++ Class Library for the Garmin GPS www.stempsoft.com yes, if you try to instantiate the class in your code it should. "Bruce E. Stemplewski " <BruceStemplewski@hotmail.com> wrote in message news:uaGJZhYCFHA.3732@TK2MSFTNGP14.phx.gbl... > It's been a while since I have written anyt...

How to export exchange global address book to WAB file?
I would like to export exchange address book to outlook express address book. How to export exchange global address book to WAB file? Mesak wrote: > I would like to export exchange address book to outlook express > address book. How to export exchange global address book to WAB file? I don't know about wab files, but see if http://www.slipstick.com/exs/portagal.htm helps at all. ...

Export to Outlook Express
Hi Group, Is it possible to export the messages from Outlook XP into Outlook Express? Thanks in advance, Marco Have you tried the import from Outlook from Outlook Express? I forget which one works but yes, you can get your mail into Outlook Express. It is either import from OE or Export from Outlook. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the (insert latest virus name here) virus, all mail sent to my personal account will be deleted without reading. After searching google.groups.com and finding no answer, Limonzitos aske...

function keys
Hello, Is there a site where I can get a recap of RMS function keys? Not that I know of, but F1 - Help is a really good place to start! Glenn Adams Tiber Creek Consulting http://www.tibercreek.com glenn@tibercreek.com ---------------------------------------------- Please DO NOT respond to me directly but post all responses here in the newsgroup so that all can share the information. newbie wrote: > Hello, > Is there a site where I can get a recap of RMS function keys? This is a multi-part message in MIME format. ------=_NextPart_000_02DF_01C6B6FC.B3481FA0 Content-Type: text/plain; ...

Re: http://bassturk20.piranho.de/
"rghjbnmj" <196161> ha scritto nel messaggio news:... > > "bayrm" <bozkurt-0@hotmail.de> ha scritto nel messaggio > news:0C307C2E-9B41-4864-8BC6-07947A6C90D9@microsoft.com... >> Bassturk-Online-Games >> Call of Duty: Modern Warfare 2 Geschrieben von: Administrator >> Dienstag, den 17. November 2009 um 20:45 Uhr >> >> Call of Duty: Modern Warfare 2 >> >> Noch immer herrscht im offiziellen Forum von Infinity Ward >> Ausnahmezustand. >> Viele Spieler beschweren sich �ber die fehlenden De...

Attach Trigger to Save Function of Form
I am in the processes of trying to attach a trigger to the Save function of an already existing GP form using Dex. In one of the documents, it states that the CM_Checkbook_Maitenance has a SaveRecord function. I am trying to acces the function that is similar to this on the PM_Vendor_Maitenance form. I tried using SaveRecord and when I tried to compile it it says that it is an unknown reference. Is there some documentation with a list of the functions for each form? Mike, PM_Vendor_Maintenance is an older form and probably doesn't have a SaveRecord function. Try running t...

visited links no longer change color
The links still work when clicked but, no longer show purple when visited. This happens in both Outlook and Outlook Express. Yesterday I tried making fonts a little larger as I have eyesight problem. Not sure if this is when the link color problem started. What I did exactly is: *Tools > Options > Mail Format > click "Fonts" button > click "International Fonts" button * At first I went through the list making each one "Larger" font size. * I realized that it's probably only "Western European" I need to change, so all others were set ...

Re-exporting functions from dynamically linked DLL
Hi, I have the following situation: I have a 3rd party DLL which does not include a LIB file, just a header file with typedef declarations for exported functions (It is intended for dynamic linking) I need to wrap the DLL to allow for callbacks to my own code (in Lisp), and to do this I need to load the DLL using LoadLibrary and access each function that I need using GetProcAddress. So for example: The third party header will say: typedef INT (WINAPI * lp_function)(); Then in my c wrapper file: #include "3rdparty.h" #ifdef _WIN32 #define DllExport __declspec(dllexport) #else #...

how can i use countif function inside a filtered range
How can I use countif function inside a filtered range Hi, Not much detail here, so this is the general idea: =SUMPRODUCT(SUBTOTAL(3,OFFSET(C13:C18,ROW(13:18)-13,0,1)),--(C13:C18="Red")) -- If this helps, please click the Yes button Cheers, Shane Devenshire "jayin" wrote: > How can I use countif function inside a filtered range Shane Devenshire wrote on 02/24/2009 02:05 ET : > Hi, > > Not much detail here, so this is the general idea: > > =SUMPRODUCT(SUBTOTAL(3,OFFSET(C13:C18,ROW(13:18)-13,0,1)),--(C13:C18=&quot;Red&quot;)) > > ...

dll class constructor problem
I have a class in a dll that looks like: class __declspec(dllexport) MyClass { public: MyClass(void) ; ~MyClass(void) ; int x; };; in the implementation for the constructor, I have: MyClass::MyClass(void) : x(555) { } When I use the dll in the client application to create a MyClass instance, the instance variable x is not initialized; I have a huge value like -842150451. Did I do something wrong? "wanwan" <ericwan78@yahoo.com> wrote in message news:1177618221.977457.144800@r30g2000prh.googlegroups.com... >I have a class in a dll that looks like: > &g...

Outlook 2002/2003 auto-complete function
How do i clear out the "database" of the auto-complete function in the To,cc and bcc fields. i know how to do a single name clear by clicking delete is there a way to clear all the names out? To clear the entire cache, follow the instructions here: http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q287623 -- Russ Valentine [MVP-Outlook] "Brian James" <bjames@beconet.com> wrote in message news:009101c3ad51$120b6a00$a501280a@phx.gbl... > How do i clear out the "database" of the auto-complete > function in the To,cc and bcc fields. i know how...

Dynamic Access Report from filtered Form
I need help. I have succuess fully applied the "how to create a dynamic crosstab report in access" from instructions off of microsofts web site to my own report and query. My problem is this. I have a form in datasheet view, based off a query. When the form is open I can hide / unhid columns as needed and apply filter by form. That all is great. But now I want to beable to send the filtered data on the datasheet form to the Dynamic Report I created showing only the filtered records and also only show the columns that I did not have hidden on my form. How do I do this? I have t...