[Mono-devel-list] Need help with DllImport.

Gary M. Smithrud gary.smithrud at haley.com
Fri Jun 3 09:56:02 EDT 2005


I receive the following error when running an application under Mono 1.1.7 
using DllImport:

in (wrapper managed-to-native) 
Haley.HaleyRules.DevelopmentKnowledgeBase:_InitializeKnowledgeBase4development 
(intptr,intptr,intptr,intptr,Haley.HaleyRules.KnowledgeBase/MemoryCallback,Haley.HaleyRules.KnowledgeBase/ExitCallback,Haley.HaleyRules.KnowledgeBase/WarningCallback,string,intptr,intptr,intptr,intptr,intptr)
in <0x00069> Haley.HaleyRules.DevelopmentKnowledgeBase:.ctor 
(Haley.HaleyRules.WarningDelegate warningDelegate, System.Object theObject)
in <0x001e7> 
HaleyRules.StandardAPItest.StandardAPItest:TestDevelopmentKnowledgeBase ()
Exception  should not happen: System.NullReferenceException: Object reference 
not set to an instance of an object
in <0x04221> 
HaleyRules.StandardAPItest.StandardAPItest:TestDevelopmentKnowledgeBase ()
in <0x00011> HaleyRules.StandardAPItest.StandardAPItest:Main (System.String[] 
args)

The "Exception should not happen:" is an exception that wraps the actual 
exception in one of our regression tests (which actually has exceptions that 
should occur).  The code works fine under Windows/.NET, the LD_LIBRARY_PATH 
is set appropriately to find the libraries, etc.

The DLL containing the InitializeKnowledgeBase relies on other shared 
libraries that are also part of the project and under Mono 1.1.4 I could 
create a single library that reference the others and it would work then 
(definitely not ideal).  Under 1.1.7 that trick doesn't work either.  I also 
tried importing a function that just returned TRUE, but that caused the same 
error.  I tried building the source and using GDB to track down the issue but 
that just caused Mono to throw a bunch of SIGTRAPs and GDB didn't handle it 
well.  These are all C functions and not C++. Are there some compiler/loader 
flags that I am just missing?

Thanks,
Gary.



More information about the Mono-devel-list mailing list