View previous topic :: View next topic |
Author |
Message |
darlyb
Joined: 16 Aug 2010 Posts: 2
|
Posted: Mon Aug 16, 2010 3:28 pm Post subject: Problems in linking to 3rd party DLL (VS 2008) |
|
|
I seem unable to link to my external DLL when using the VS 2008 IDE and modifying the project properties (probably because I do not know what setting to change).
Using the IDE I can build the obj code from the ftn95 code and then use : slink xxx.obj mydll.dll. This creates an exe that will run and reference the function from the DLL.
Whenever I add mydll.dll to the project settings, the dll appears in the slink output but as its before the obj code (which is in the link.lst file) it gives a warning about the function is missing. I can also get this error from the command line if using : slink mydll.dll xxx.obj, it would appear the parameters passed to slink are order sensitive. |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Mon Aug 16, 2010 7:13 pm Post subject: |
|
|
The order is probably not significant but there are cases when the compiler needs to be able to "see" the DLL at compile time or alternatively have access to the correct function interface.
In other words you may been assuming the default interface whilst the DLL contains different function details. For example the DLL may have been created using STDCALL whilst the usage does not include this information.
Help may be available for you here if you can provide details of how the function is defined in the DLL and how it is called in the exe etc. |
|
Back to top |
|
 |
darlyb
Joined: 16 Aug 2010 Posts: 2
|
Posted: Tue Aug 17, 2010 9:10 am Post subject: |
|
|
The DLL is built using VS 2005 and all exported functions are defined as STDCALL (WINAPI). Function in ftn95 is defined as stdcall func 'exportedfunc' (val, val) : integer * 2.
The DLL is accessible during compile time as the full path is entered, it all works when dropping to the command line and using slink.
Not sure if it is relevant but when using the command line if the order is obj then dll it will compile an exe that runs and calls the function, if the order is dll then obj it will compile with with a warning of 'Warning the following symbols are missing : <function name> <obj name>. You can then run this exe which then throws a 'Run-time Error' call to missing routine <function name>.
For the time being I have set the project to supress linking and then do a post build setup calling slink obj dll - this is working without problems. |
|
Back to top |
|
 |
|