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

Gary M. Smithrud gary.smithrud at haley.com
Fri Jun 3 10:07:52 EDT 2005


Bleep!  I hate when I don't provide all the information that I was going to.  
I forgot to mention that this was under Suse 9.3, gcc version is: 3.3.5, ld: 
2.15.94.0.2.2.

On Friday 03 June 2005 09:56, Gary M. Smithrud wrote:
> I receive the following error when running an application under Mono 1.1.7
> using DllImport:
>
> in (wrapper managed-to-native)
> Haley.HaleyRules.DevelopmentKnowledgeBase:_InitializeKnowledgeBase4developm
>ent
> (intptr,intptr,intptr,intptr,Haley.HaleyRules.KnowledgeBase/MemoryCallback,
>Haley.HaleyRules.KnowledgeBase/ExitCallback,Haley.HaleyRules.KnowledgeBase/W
>arningCallback,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.
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list



More information about the Mono-devel-list mailing list