- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have the following situation:
RoutineA and RoutineB are compiled in a static library (Lib1)
RoutineC is compiled in a dynamic linked library (Dll1)
Lib1 is linked to an executable EXE. At runtime I load Dll1 into the executable and RoutineA calls RoutineC (I learned how to do this from a forum entry onhttp://www.xeffort.com).
This all works great, the problem is that I would like RoutineC to call RoutineB in the original library. Right now the only way I can get this to work is by passing a reference to RoutineB into RoutineC: e.g:
subroutine RoutineA
...
call RoutineB(... , RoutineC)
...
ensubroutine
Is there a way to do this without passing the reference?
I have Composer XE 2011 and use windows, linux, and mac versions. Thanks guys!
Nate
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Look in the IVF reference guide under "proceedure pointers".
In routine C (the dll)
add a collection of proceedure pointers (uninitialized (=>NULL))
add an init function that is passed the pointer(s) and copies pointer(s) into appropriate proceedure pointer
Once this is done the dll can use the proceedure pointer for calling the proper function.
Also, in place of default initilaization to =>NULL you could point to a function that gracefull informs the user that the init was not called
Jim Dempsey
In routine C (the dll)
add a collection of proceedure pointers (uninitialized (=>NULL))
add an init function that is passed the pointer(s) and copies pointer(s) into appropriate proceedure pointer
Once this is done the dll can use the proceedure pointer for calling the proper function.
Also, in place of default initilaization to =>NULL you could point to a function that gracefull informs the user that the init was not called
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't think we support the F2008 feature of having a function for default initialization of a procedure pointer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you Jim and Steve! I haven't implemented this yet but it looks like just what I need. Since the initialization will be done right after the dll is loaded and can be initiated by LIB1 then as the programmer of LIB1 (clients will write their own DLL1's)I can put in the appropriate error checking there and unload the dll if the initialization fails preventing further problems.
Nate
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I use DLLEXPORT to export routines from my exe file. Then dll libraries used by this exe file can use these routines (in the same way as exe file uses exported routines from dll). It works well.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page