LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

LoadExternalModule throws error (-7 Unknown file extension) when working with source-code.

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)
{
}

0 Kudos
Message 1 of 8
(5,262 Views)

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.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 8
(5,259 Views)

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/   ????

 

 

0 Kudos
Message 3 of 8
(5,256 Views)

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.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 8
(5,254 Views)

Yes, the file is listet in the project-file ..

 

building the project is OK ..

 

Create object-file of Test.c is OK ..

 

 

 

 

0 Kudos
Message 5 of 8
(5,251 Views)

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 the LoadExternalModule and LoadExternalModuleEx 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,

Daniel Dorroh
National Instruments
0 Kudos
Message 6 of 8
(5,210 Views)

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.

0 Kudos
Message 7 of 8
(5,198 Views)

Hi,

Thanks for teh inf regarding the LoadExternal Module,

Using the LoadExternalmodule as you mentionned requires using a .obj file but this lead me to an issue getting a Control value from an .obj file called from a dll


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

 

0 Kudos
Message 8 of 8
(4,724 Views)