- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I created a IVF DLL that is successfully being called from VB.Net. I want to create a small stub IVF console EXE that also calls the same DLL and am having some difficulty.
I have two IVF projects in a single solution; the EXE "depends" on the DLL, so no explicit link to the .LIB file is needed. I can successfully reference and call a DLL routine that has no arguments, but when trying to call one with arguments, get the error:
Error13 error LNK2019: unresolved external symbol _RIV1Q_GETVARCOUNT referenced in function _MAIN__Riv1Q_EXE.obj
I ran DUMPBIN on the DLL LIB file and get this:
Microsoft COFF/PE Dumper Version 8.00.50727.42
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file riv1q.lib
File Type: LIBRARY
Exports
ordinal name
Riv1Q_Cancel
Riv1Q_Compute
Riv1Q_GetData
Riv1Q_GetErrMsg
Riv1Q_GetProgress
Riv1Q_GetVarCount
Riv1Q_GetVarName
Riv1Q_GetVarUnits
Riv1Q_Initialize
Summary
C0 .debug$S
14 .idata$2
14 .idata$3
4 .idata$4
4 .idata$5
A .idata$6
My DLL routine looks like this:
[vb] SUBROUTINE Riv1Q_GetVarCount(VarCount) !DEC$ ATTRIBUTES DLLEXPORT, STDCALL :: Riv1Q_GetVarCount !DEC$ ATTRIBUTES ALIAS:'Riv1Q_GetVarCount' :: Riv1Q_GetVarCount INCLUDE 'Riv1Q.inc' INTEGER, INTENT(OUT) :: VarCount(3) !DEC$ ATTRIBUTES REFERENCE :: VarCount [/vb]
My call to that routine looks like this:
[vb]!DEC$ ATTRIBUTES DLLIMPORT, C, ALIAS:'Riv1Q_GetVarCount' :: RIV1Q_GETVARCOUNT INTEGER VarCount(3) call riv1q_getvarcount(varcount) [/vb]
[vb]The DUMPBIN output appears that it isn't really STDCALL, but changing the attributes to C doesn't solve the problem.[/vb]
[vb]Thanks in advance for your assistance.[/vb]
[vb][/vb]
[vb]Chris[/vb]
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Because you have the ALIAS, the external name does not change with C or STDCALL. However, these MUST be consistent or else you'll have run-time problems.
Is your main program source fixed-form, with a file type of .F or .FOR? I think you'll find that the directive you added in the main program extends past column 72 and therefore doesn't have the effect you intend. You may need to split this into two or more lines as you do in the DLL routine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That's what I like to hear. Glad to have been of help.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page