Apologies. Please disregard, wrong list.


----- Original Message ----
From: sam ch <samc...@yahoo.com>
To: nant-users@lists.sourceforge.net
Sent: Wednesday, August 12, 2009 1:19:58 PM
Subject: type initializer for 'win32DllPINVOKE' threw an exception

Hello,

I am new to swig and I am attempting to use it by first creating a simple 
project. Everything compiled correctly, but I get an exception while running. I 
believe it is something simple, but I am just not sure where to look. Any tips 
would be appreciated, thanks.


joe

STEPS I TOOK:

1. Within VS2005, created a new C++ Win32 DLL project called "win32Dll"
2. Added code files "code.h" and "code.cpp"
3. Within the "code" files, created a function called "getNumber()" which 
returns an integer 5
    int getNumber(){
        return 5;
    }
??? Note: I originally had "__declspec(dllexport)" in the function declaration 
but received an error ("code.h:3: Error: Syntax error in input(1).") ???
4. Built the project which created a "win32Dll.dll"
5. Created "win32_dll.i" which just referenced "code.h"
6. Within Cygwin, ran "swig -csharp -c++ win32_dll.i"
7. Within the "VSS Command Prompt", ran "csc /target:library /out:win32 
Dll_wrap.dll *.cs" which resulted in "Dll_wrap.dll" being created
8. Created a new C# project called "dllTester" and set it as the startup project
9. Added a reference to "Dll_wrap.dll" and called "win32Dll.getNumber()"

Error result: "The type initializer for 'win32DllPINVOKE' threw an exception." 
with InnerException.Message "The type initializer for 'win32DllPINVOKE' threw 
an exception."

***Note: To ensure that my DLL actually works, I was able to get to the 
function to work through InteropServices. 


      

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to