Thread: Can anyone help me with a DLL?

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    8

    Can anyone help me with a DLL?

    I have written a DLL which is called upon by Visual Basic. The cod which it is having problems with is:

    Code:
    NOMANGLE int CCONV readfile(int *lparray, int pixelbit, long head, long width, long height, LPSTR fname)
    Alledgedly, this code has three errors:
    C:\Uni\C\Source Code\readanddraw.c(19) : error C2061: syntax error : identifier 'readfile'
    C:\Uni\C\Source Code\readanddraw.c(19) : error C2059: syntax error : ';'
    C:\Uni\C\Source Code\readanddraw.c(19) : error C2059: syntax error : 'type'

    I can't understand any of these errors and why they would possibly exist. Could anyone help?

    Thanks!

    BTW, that line of code I have posted is line 19.

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    To follow on....the NOMANGLE & CCONV symbols are not familiar to me........from what I can guess they are there to stop C++ function mangling....is this correct?

    If so, then your compiler will have a specific method to do this...

    With MSVC++ I would do the following...

    Code:
    #define DllImport extern "C" __declspec (dllimport)
    
    
    
    
    DllImport int MyReadFile(int *lparray,
    			 int pixelbit, 
    			 long head, 
    			 long width, 
    			 long height, 
    			 LPSTR fname);
    That would normally allow me to import without problems....but then I cant guarantee as every dll I have ever written has been in C++

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. non-MFC DLL with MFC app question.
    By Kempelen in forum Windows Programming
    Replies: 10
    Last Post: 08-20-2008, 07:11 AM
  2. Replies: 1
    Last Post: 09-18-2005, 09:06 PM
  3. dll communicating between each other
    By cloudy in forum C++ Programming
    Replies: 5
    Last Post: 06-17-2005, 02:20 AM
  4. DLL and std::string woes!
    By Magos in forum C++ Programming
    Replies: 7
    Last Post: 09-08-2004, 12:34 PM
  5. .lib vs .h vs .dll
    By Shadow12345 in forum C++ Programming
    Replies: 13
    Last Post: 01-01-2003, 05:29 AM