10-29-2013 03:17 AM
Utility library function LoadExternalModule (admittedly marked as obsolete - but key to one of our older software)
fails with error code (-7 Unknown file extension.) in CVI 2012SP1 and 2013 Version 13.0.0(647) on Win7
The suggested alternative Win32 API GetProcAddress doesn't work with source or obj files (so isn't an alternative at all)
The Target-Settings to "Enable LoadExternalModule" are already checked.
Any suggestions ?
This code-snipped shows the behavior :
// File "Main.c"
// ------------------------------
#include <utility.h>
int main(void)
{
void (*funcPtr) (void);
int moduleID;
int status;
// Library-Function-Error : -7 Unknown file extension.
moduleID = LoadExternalModule ("Test.c");
funcPtr = GetExternalModuleAddr (moduleID, "test_function", &status);
(*funcPtr) ();
return 0;
}
// File "Test.c"
// ------------------------------
void test_function(void)
{
}
10-29-2013 04:10 AM
LoadExternalModule cannot be used with source files: you must load a compiled module instead (either .LIB or .OBJ files). See here for the rules that apply to those files.
10-29-2013 04:28 AM
Thank you for this quick response.
Is this a new behavior to CVI 2013 ?
I know, in previous versions of CVI it was possible to load the source-file for debug-reasons ..
it also does not work with CVI 2012 .. but it should, look at http://zone.ni.com/reference/en-XX/help/370051V-01/cvi/libref/cviloadexternalmodule/ ????
10-29-2013 04:45 AM
Yes, you're right, I didn't focused on that part of the help. My comment was referred to CVI2012, but I must admit I have never loaded a source file.
Is the file you are trying to load listed in your project? It seems it cannot load it if not.
10-29-2013 04:53 AM
Yes, the file is listet in the project-file ..
building the project is OK ..
Create object-file of Test.c is OK ..
10-30-2013 06:26 PM
Hi baggyman,
I can confirm that passing .c
files to LoadExternalModule
is no longer supported in LabWindows/CVI 2013. It looks like this change did not make it into the LoadExternalModule
help file, but it was included in the LabWindows/CVI 2013 Readme:
You cannot specify a.c
file as the module to load to theLoadExternalModule
andLoadExternalModuleEx
functions.
I will make sure we update the LoadExternalModule
help as soon as we can.
I apologize for any inconvenience this change may have caused.
Warm Regards,
10-31-2013 02:28 AM
Hello D-Cubed,
thank you for the clarification ..
we found out a strange but useful behavior :
passing an empty string to LoadExternalModule as path to module returns a valid module_id.
The execution of GetExternalModuleAddr returns the right pointer to the desired function.
The following function-call causes the debugger to jump to the desired function source-code ..
regards
Heinz S.
01-28-2014 06:35 AM
Thanks for teh inf regarding the LoadExternal Module,
When using the LoadExternalModule function in CVI 2013, we can no longer use a .c file. Instead we have to use an .obj file.
My issue is that' impossible for me to get a control value from an .iur managed by the .obj witchi is called by a dll.
Otherwise it's impossible for me to get the control vale when calling the .obj from a dll.
Any suggestions Amigos
Thanks